Skip to content

Commit 1dd3872

Browse files
authored
Suppress autocmds errors (#11)
* Change initialization order * Suppress autocmds errors * Suppress tsdetect#coc#auto#switch#*#after * Revert #10 * format code
1 parent 64ea678 commit 1dd3872

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

autoload/tsdetect.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ function! tsdetect#init() abort
1919

2020
augroup tsdetect#init
2121
autocmd!
22+
autocmd User tsdetect#detect :
23+
autocmd User tsdetect#detect#node :
24+
autocmd User tsdetect#detect#deno :
25+
autocmd User tsdetect#coc#auto#switch#node#after :
26+
autocmd User tsdetect#coc#auto#switch#deno#after :
2227
autocmd FileType javascript,javascriptreact,typescript,typescript.tsx,typescriptreact ++nested call <SID>detect_filetype()
2328
autocmd BufEnter,BufNewFile,BufWritePost * ++nested call <SID>detect_buffer(expand('<amatch>'))
2429
augroup END

src/entrypoints/coc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const activate = async (context: ExtensionContext): Promise<void> => {
2424
if (!paths.includes(context.extensionPath)) {
2525
await workspace.nvim.command(`execute 'noautocmd set runtimepath^='.fnameescape('${context.extensionPath}')`);
2626
}
27+
await workspace.nvim.command('runtime plugin/tsdetect.vim');
2728

2829
// Setup manual commands.
2930
(['deno', 'node'] as const).forEach((target) => {
@@ -54,5 +55,4 @@ export const activate = async (context: ExtensionContext): Promise<void> => {
5455

5556
// Initialize after launched coc-tsdetect.
5657
await initialize(context);
57-
await workspace.nvim.command('runtime plugin/tsdetect.vim');
5858
};

0 commit comments

Comments
 (0)