Comments (5)
Are you saying that prior to running any ApplyWorkspaceEdit, the client must send didOpen (and then send a didChange explicitly as well).
That is the way I understood the spec.
If a file is closed
and a WorkspaceEdit comes in for the file,
the client would first need to open that file (that should send a didOpen notification)
and then apply the edits (that should send a didChange notification).
from typescript-language-server.
Spec talks about ownership and that the editor has to send didOpen to take ownership of the document before it can change it:
- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didChange
- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didOpen
from typescript-language-server.
I'm a bit confused. I've read those parts of the spec, but I don't know if it explains the inconsistent behavior that occurs when import1.ts has been open - and then closed - on the client vs. when it never has been opened on the client at all.
When it's never been opened at all, the imports get updated correctly. However when it's been opened and then closed, suddenly things do not work.
Are you saying that prior to running any ApplyWorkspaceEdit
, the client must send didOpen
(and then send a didChange
explicitly as well). I'm struggling to understand how that would work for situations where a file on the filesystem has been edited programmatically, through any other means.
from typescript-language-server.
It feels like there is some distinction being made for files that have programmatic edits triggered by an ApplyWorkspaceEdit
, versus any other file that was edited programmatically.
Here's an example:
- I create a file in my editor import3.ts and save it with the contents:
import { a } from './export';
- I then close it. I then open it in
vi
and change the contents to:
import { a } from './mangledimportpath.xyz'
- Since there is no file open in vscode - there is not a
didChange
notification made to tsserver - it just has file watchers running. - I then rename export.ts to export2.ts
- In vscode, tsserver sends a
getEditsForFileRename
and knows that import3.ts has been updated, no longer imports from export.ts, and thus, it doesn't include import3.ts in its list of file changes.
The only difference here between the above edit of a closed file, and this edit of a closed file, is that one was initiated by an ApplyWorkspaceEdit
and one was not. So is the language server tracking the WorkspaceEdit
s it proposes to see if the client actually applies them or not?
from typescript-language-server.
Here's an example:
I've tried it here and it worked fine for me.
If you want me to have a look into it then please:
- provide a repo that reproduces this simplified case
- set
initializationOptions.tsserver.logVerbosity
toverbose
and provide the tsserver log that is created in the.log
directory after reproducing the issue
from typescript-language-server.
Related Issues (20)
- Use diagnostic range when requesting `getCodeFixes` HOT 4
- checkJs on not respected with declaration files HOT 2
- Completion items have incorrect "kind" HOT 6
- Typescript Server Error when `includeInlayVariableTypeHints = true` and an arrow function is made. HOT 1
- Deprecated property not marked as such HOT 3
- problems with `interface` structure HOT 3
- How to Disable "Move to a new file" action? HOT 2
- typescript server error when using 'inlay hints' (Unexpected node.^M) HOT 1
- Debug Failure. Unexpected node. HOT 5
- env: node: No such file or directory on MacOS HOT 3
- SyntaxError: Unexpected token import HOT 1
- importModuleSpecifierEnding is not respected HOT 1
- Unable to initialize, language server cannot read properties of undefined (reading 'workspace') HOT 1
- Add Semantic Tokens for Template Literal Strings HOT 1
- Ignore typescript type errors in `.js` / `.jsx` files HOT 3
- neovide GUI "env: node: No such file or directory HOT 1
- Is it possible to filter build-in types? HOT 1
- Does not format .tsx files HOT 4
- suggest autocompletion that script in node_module only HOT 5
- Server initialization failed with "command '_typescript.applyWorkspaceEdit' already exists" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-language-server.