workspace.onDidOpenTextDocument cannot work
Freed-Wu opened this issue · 6 comments
Freed-Wu commented
Result from CocInfo
versions
vim version: NVIM v0.10.2
node version: v20.18.0
coc.nvim version: 0.0.82-9fd85781 2024-09-21 00:59:00 +0900
coc.nvim directory: /home/wzy/.local/share/nvim/repos/github.com/neoclide/coc.nvim_release
term: tmux
platform: linux
Log of coc.nvim
2024-11-24T22:30:58.650 INFO (pid:1067148) [plugin] - coc.nvim initialized with node: v20.18.0 after 78
2024-11-24T22:30:58.669 INFO (pid:1067148) [core-watchman] - watchman watching project: /dev/shm/coc-test
Describe the bug
import { ExtensionContext, window, workspace } from 'coc.nvim';
export async function activate(context: ExtensionContext): Promise<void> {
context.subscriptions.push(workspace.onDidOpenTextDocument(event => {
window.showInformationMessage("test");
}));
}
#!/usr/bin/env -S vi -u
set runtimepath=$VIMRUNTIME
set runtimepath+=~/.local/share/nvim/repos/github.com/neoclide/coc.nvim_release
let s:root = fnamemodify(expand('<sfile>'), ':p:h:h')
execute 'set runtimepath+=' . s:root
let g:coc_config_home = '.'
let g:coc_data_home = s:root . '/node_modules/coc'
set formatexpr=CocAction('formatSelected')
Then
tests/test.vim tests/test.vim
Expected:
Display test after open test.vim
Actually:
Nothing happened.
fannheyward commented
I encountered this before; I remember that the event was fired before the extension was activated.
After extension activated, open document like :e foo
will fire this event.