-
Hello, I have a file It seems that Langium keeps a document in the index in case the file extension is changed and not supported by the language. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
When a.mydsl is renamed to a.mydsl.old, it calls first DefaultDocumentUpdateHandler.didChangeContent() then DefaultDocumentUpdateHandler.fireDocumentUpdate(). I think that the incorrect behavior comes from DefaultServiceRegistry.hasServices() that returns true for uri Maybe that an other interface such as ServiceRegistry.hasValidFileExtension(uri:URI) would be more appropriate ? |
Beta Was this translation helpful? Give feedback.
-
Hey @ydaveluy, This is intended behavior (at least in VS Code). See also #1492 which contains links to a discussion surrounding this issue. In the end, we only listen to what the language client tells us. In VS Code, if you rename a file extension to something that doesn't have a language associated with it, it will keep the old language association. You will see that the renamed file keeps the same language id (in the status bar). We correctly identify that by taking a look at the text document provided by the language client. You can disable that behavior by overriding the |
Beta Was this translation helpful? Give feedback.
-
Ok thanks for the recommendation :-) |
Beta Was this translation helpful? Give feedback.
Hey @ydaveluy,
This is intended behavior (at least in VS Code). See also #1492 which contains links to a discussion surrounding this issue. In the end, we only listen to what the language client tells us.
In VS Code, if you rename a file extension to something that doesn't have a language associated with it, it will keep the old language association. You will see that the renamed file keeps the same language id (in the status bar). We correctly identify that by taking a look at the text document provided by the language client.
You can disable that behavior by overriding the
ServiceRegistry
. I wouldn't recommend it though, because this already works exactly how it's supposed to work.