Replies: 1 comment 1 reply
-
Can you start simple and specify what issues do you see when you open a file without workspace root set? tsconfig.json shouldn't be technically needed (certain defaults will be used in that case) and there shouldn't be any errors. Try to provide a reproduction that will allow us to understand whether what you are seeing is specific to you (or neovim). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using tsserver with the neovim LSP client. I have not been able to figure out how to properly configure tsserver from my editor (to set the workspace path, if that is even possible), but regardless of that, I'm able to test by surgically modifying tsserver's runtime code in order to validate my hypothesis.
I wrote up what I have tried so far in here: pmizio/typescript-tools.nvim#259
Now what I have found is even if I override the value of
this.workspaceRoot
in the call tothis.tsClient.start
incli.mjs
, it does not change behavior but if I override both that and the return value ofgetProjectRootPath
, e.g.:I apparently was able to force tsserver to find the global dependencies like this.
Obviously I can't leave the code hardcoded like this, and I also cannot grok anywhere close to enough of this code to make sense of what the intention and interpretation of the tsserver config is meant to be, but something tells me based on this experiment that the config is ill-defined if the open file is ever found not to be in the projectRootPath that's been determined.
That assumption is perhaps a reasonable one. But given how well
tsx
works I wanted to explore a world in which we can run typescript independently of any project or workspace structure, and it seems impossible to do that with tsserver as it exists right now.Can anyone confirm that my hunch is correct on this? If so what architectural changes would be needed to address this use case? Since I seem to have been able to hack it to work by hard coding some root path values in the code maybe it's not a lot of work.
Beta Was this translation helpful? Give feedback.
All reactions