-
Notifications
You must be signed in to change notification settings - Fork 354
Closed
Labels
info-neededIssue requires more information from posterIssue requires more information from poster
Description
Hi~ I found an error descibed above, and my versions are listed below:
package | version |
---|---|
vscode-eslint | 2.1.5 |
@typescript-eslint/parser | 2.27.0 |
TypeScript | 3.7.2 |
ESLint | 6.8.0 |
vscode | 1.44.1 |
Node.js | 12.8.1 |
V8 | 7.8.279.23-electron.0 |
OS | Linux x64 4.13.0-36-generic |
eslint configs:
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
ecmaVersion: 6,
sourceType: 'module',
project: 'tsconfig.json',
}
}
This error happens when I use symlink as my workspace dir, e.g.
/home/xxx/workspace/ -> /workspace
I tried to div into source code and found languageServer use symlink uri when file changed, e.g.
/home/xxx/workspace/src/index.js
but typescript-estree use extra.tsconfigRootDir = '/workspace' to createProjectProgram.
I also found a way to solve this problem:
function getFileSystemPath(uri: URI): string {
const result = uri.fsPath;
if (process.platform === 'win32' && result.length >= 2 && result[1] === ':') {
// Node by default uses an upper case drive letter and ESLint uses
// === to compare paths which results in the equal check failing
// if the drive letter is lower case in th URI. Ensure upper case.
return result[0].toUpperCase() + result.substr(1);
} else {
return fs.realpathSync(result); // I added fs.realpathSync to solve this problem
}
}
Let me know if this solution is correct, thank you
jpustula, chemitaxis, tamj0rd2, tbuschto and BobNobrain
Metadata
Metadata
Assignees
Labels
info-neededIssue requires more information from posterIssue requires more information from poster