Closed Bocom closed 4 years ago
LSP consistently uses upper-case drive letter which doesn't seem to play well with Typescript server.
"rootPath": "C:\\workspace\\project",
"rootUri": "file:///C:/workspace/project",
"workspaceFolders": [
{
"name": "project",
"uri": "file:///C:/workspace/project"
}
]
VSCode (also it encodes :
in URI but I doubt this would be something required by spec since browsers don't do that):
"rootPath": "c:\\workspace\\project",
"rootUri": "file:///c%3A/workspace/project",
"workspaceFolders": [
{
"uri": "file:///c%3A/workspace/project",
"name": "project"
}
]
Interestingly it doesn't reproduce in Typescript server itself so it could be an issue with something in vetur.
Looks like vetur does some custom transformations.
called from here for example:
https://github.com/sublimelsp/LSP-vue/releases/tag/1.1.1 includes the latest version of vetur that includes my fix for this.
When using relative imports on Windows, the casing of the drive letter causes Vetur to report the following error:
File name 'c:/Projekt/temp/lsp-vue-repro/src/App.vue' differs from already included file name 'C:/Projekt/temp/lsp-vue-repro/src/App.vue' only in casing.
The import looks like this:
import App from './App.vue'
This happens regardless of TypeScript being used or not. Setting
forceConsistentCasingInFileNames
tofalse
intsconfig.json
, as suggested in other instances of this error popping up, doesn't seem to be doing much.The only workaround I've found that works is creating a Sublime Text project and replacing
"path": "."
with an absolute path with a lowercase drive letter. It works but isn't an ideal solution. In TypeScript projects, using custom paths defined usingpaths
intsconfig.json
doesn't activate this error. Imports using a custom path shows an absolute path with an uppercase drive letter. When using the project workaround, the drive letter is lowercased as well.This error does not occur in Visual Studio Code.
Minor detail: for some reason, when a
.vue
file is imported from a.js
or.ts
file, the error is reported inside the imported.vue
file. In this case, it would be reported on line 1 column 1 ofApp.vue
. When importing a.vue
file from another.vue
file, the error is marked on the import statement's path.Reproduction repo: https://github.com/Bocom/lsp-vue-repro It's a simple vite project.
To reproduce Add the folder in Sublime Text on Windows. Open the file
src/App.vue
. There should be an error at 1:1 and 7:24 that's similar to the one at the top of this issue.System info OS: Windows 10 2004 Sublime Text: version 4090 LSP:
st4000-exploration
LSP-vue: the latest from Package Control