xnorly
1
Hi everyone
I wanted to create an issue, but I thought I should ask here first, maybe I’m missing something.
My setup
- iTerm2 3.4.15
- NeoVim 0.6.1
- typescript-language-server@0.9.7 (installed globally with npm)
- typescript@4.6.3 (installed globally with npm)
- a react typescript project created with
yarn create react-app
Reproducing steps
- download the minimal_init.lua file (with
local name
set to "tsserver"
) and put it in the react project folder
-
cd
into the react project folder and open up src/App.tsx
with neovim (using the minimal_init.lua file):
nvim -u minimal_init.lua src/App.tsx
- hit
:q
and enter
to close the window showing packer.nvim
- move the cursor to the first instance of the word
className
(use h
, j
, k
, l
to move around)
- (still in neovim) run the following command
:lsp vim.lsp.buf.rename("newName")
which should change all occurrences of className
to newName
- hit
u
to undo the renaming (this only reverts the changes in App.tsx file, but not the changes made in other files)
- try using the renaming command from above once again
What I expected
that all occurrences of className
would be renamed again
What happened
only the instance under the cursor changed, all other instances remained unchanged
Observations
If the undo operation is done in all affected files (not just in App.tsx
), the renaming will work again correctly
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
I assumed you also commented out cmd
so you were not using pyright?
There’s nothing wrong clientside so it would be a question for the typescript-language-server repo.
xnorly
3
Hi @mjlbach
Yes I also commented out the line with cmd
.
Ok, so I will make an issue on their repo.
Thanks for the fast response!
xnorly
4
Here is the issue I created
kaiuri
5
You might find answers here:
xnorly
6
at the moment I’m using only
‘jose-elias-alvarez/null-ls’
I tried using ‘jose-elias-alvareztyepscript’ too, but as soon as I opened up a .tsx file, it threw the error:
typescript.nvim/lua/typescript.lua:2581: attempt to call field 'nvim_buf_create_user_command' (a nil value)
Which is why I stopped using it.
I used the default settings taken from the repo readme:
require("typescript").setup({
disable_commands = false, -- prevent the plugin from creating Vim commands
disable_formatting = false, -- disable tsserver's formatting capabilities
debug = false, -- enable debug logging for commands
server = { -- pass options to lspconfig's setup method
on_attach = on_attach,
},
})
fsouza
7
A bit off-topic, but that error means that the plugin requires neovim 0.7, the function nvim_buf_create_user_command
was introduced in that release.
xnorly
8
Dear @fsouza
Thank for your the information. I didn’t know that.
Will definitely check out 0.7 soon!
Best regards
xnorly
9
Ciao fsouza
I tried nvim 0.7 with jose-elias-alvarez/typescript, but I still have the same behaviour.
I also tried out VS Code, but there, renaming, then undoing the renaming, then renaming again works fine. It only happens in nvim.
Are you able to reproduce the error (following my steps)?