@@ -5,7 +5,7 @@ local M = {
5
5
compilers = { vim .fn .getenv (' CC' ), ' cc' , ' gcc' , ' clang' , ' cl' , ' zig' },
6
6
}
7
7
8
- local required_version = ' 1.3.4 '
8
+ local required_version = ' 2.0.0 '
9
9
10
10
function M .install ()
11
11
if M .not_installed () then
@@ -55,7 +55,7 @@ function M.get_package_path()
55
55
end
56
56
57
57
function M .get_lock_file ()
58
- return M .get_package_path () .. ' / .org-ts-lock.json'
58
+ return vim . fs . joinpath ( M .get_package_path (), ' .org-ts-lock.json' )
59
59
end
60
60
61
61
function M .select_compiler_args (compiler )
@@ -119,7 +119,7 @@ function M.get_path(url, type)
119
119
local is_local_path = vim .fn .isdirectory (local_path ) == 1
120
120
121
121
if is_local_path then
122
- utils .echo_info (' Using local version of tree-sitter grammar...' )
122
+ utils .notify (' Using local version of tree-sitter grammar...' )
123
123
return Promise .resolve (local_path )
124
124
end
125
125
@@ -132,7 +132,7 @@ function M.get_path(url, type)
132
132
reinstall = ' Reinstalling' ,
133
133
}
134
134
135
- utils .echo_info ((' %s tree-sitter grammar...' ):format (msg [type ]))
135
+ utils .notify ((' %s tree-sitter grammar...' ):format (msg [type ]))
136
136
return M .exe (' git' , {
137
137
args = { ' clone' , ' --filter=blob:none' , ' --depth=1' , ' --branch=' .. required_version , url , path },
138
138
}):next (function (code )
145
145
146
146
--- @param type ? ' install' | ' update' | ' reinstall' '
147
147
function M .run (type )
148
- -- local url = 'https://github.com/nvim-orgmode/tree-sitter-org'
149
- local url = ' /home/kristijan/github/tree-sitter-org'
148
+ local url = ' https://github.com/nvim-orgmode/tree-sitter-org'
150
149
local compiler = vim .tbl_filter (function (exe )
151
150
return exe ~= vim .NIL and vim .fn .executable (exe ) == 1
152
151
end , M .compilers )[1 ]
@@ -171,12 +170,19 @@ function M.run(type)
171
170
if code ~= 0 then
172
171
error (' [orgmode] Failed to compile parser' , 0 )
173
172
end
174
- local renamed = vim .fn .rename (path .. ' /parser.so' , package_path .. ' /parser/org.so' )
173
+ local source = vim .fs .joinpath (path , ' parser.so' )
174
+ local destination = vim .fs .joinpath (package_path , ' parser' , ' org.so' )
175
+ local renamed = vim .fn .rename (source , destination )
175
176
if renamed ~= 0 then
176
177
error (' [orgmode] Failed to move generated tree-sitter parser to runtime folder' , 0 )
177
178
end
178
179
utils .writefile (M .get_lock_file (), vim .json .encode ({ version = required_version })):wait ()
179
- utils .echo_info (' Done!' )
180
+ local msg = { ' Done!' }
181
+ if type == ' update' then
182
+ table.insert (msg , ' Please restart Neovim to apply the changes.' )
183
+ end
184
+ utils .notify (msg )
185
+ vim .treesitter .language .add (' org' )
180
186
return true
181
187
end ))
182
188
:wait (60000 )
0 commit comments