angular / vscode-ng-language-service

Angular extension for Visual Studio Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

language service loaded from workspace instead of extension

ikilinc opened this issue · comments

language service has works fine util 0.900.4. After 0.900.4 i noticed getting errors like this.

My Package.json:

"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "~8.2.3",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"bootstrap": "^4.4.1",
"core-js": "^3.6.4",
"date-fns": "^2.9.0",
"file-saver": "^2.0.2",
"lodash-es": "^4.17.15",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.23",
"@angular/cli": "~8.3.23",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@compodoc/compodoc": "^1.1.11",
"@types/faker": "^4.1.9",
"@types/file-saver": "^2.0.1",
"@types/jasmine": "~3.5.1",
"@types/jasminewd2": "~2.0.8",
"@types/lodash-es": "4.17.3",
"@types/node": "~13.1.8",
"codelyzer": "^5.2.1",
"faker": "^4.1.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"json-server": "^0.15.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~3.1.0",
"karma-jasmine-html-reporter": "^1.5.1",
"prettier": "~1.19.1",
"protractor": "~5.4.0",
"sonar-scanner": "^3.1.0",
"source-map-explorer": "^2.2.2",
"ts-node": "~8.6.2",
"tslint": "~5.20.1",
"tslint-angular": "^3.0.2",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.1.0",
"typescript": "3.7.5",
"webpack-bundle-analyzer": "^3.6.0"
}

Here the error.

Error: Could not find source file: 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/src/app/modules/masterdata/modules/station-groups/page/station-group/station-group.component.html'. at getValidSourceFile (c:\Users\ikilinc\Documents\Repos\TUI-NPC\rep\tui-wls-web-backoffice\node_modules\typescript\lib\tsserverlibrary.js:131075:29) at Object.getSemanticDiagnostics (c:\Users\ikilinc\Documents\Repos\TUI-NPC\rep\tui-wls-web-backoffice\node_modules\typescript\lib\tsserverlibrary.js:131297:36) at Object.proxy.getSemanticDiagnostics (c:\Users\ikilinc\Documents\Repos\TUI-NPC\rep\tui-wls-web-backoffice\node_modules\@angular\language-service\bundles\language-service.umd.js:49429:32) at Session.sendPendingDiagnostics (c:\Users\ikilinc\.vscode\extensions\angular.ng-template-0.900.7\server\index.js:1010:39) at Timeout._onTimeout (c:\Users\ikilinc\.vscode\extensions\angular.ng-template-0.900.7\server\index.js:990:19) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) { ProgramFiles: [ 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es5.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2016.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.dom.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.core.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.collection.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.generator.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.iterable.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.promise.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.proxy.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.reflect.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.symbol.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2016.array.include.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.object.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.string.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.intl.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.intl.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.promise.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.es2018.regexp.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.esnext.intl.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/typescript/lib/lib.esnext.bigint.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/tslib/tslib.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/globals.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/assert.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/async_hooks.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/buffer.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/events/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/child_process.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/cluster.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/console.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/constants.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/crypto.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/dgram.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/dns.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/domain.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/events.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/fs.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/http.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/http2.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/https.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/inspector.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/module.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/net.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/os.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/path.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/perf_hooks.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/process.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/punycode.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/querystring.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/readline.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/repl.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/stream.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/string_decoder.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/timers.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/tls.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/trace_events.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/tty.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/url.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/util.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/v8.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/vm.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/worker_threads.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/zlib.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/base.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/ts3.2/fs.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/ts3.2/util.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/ts3.2/globals.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/node/ts3.2/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/simple_webdriver_client.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/webdriver_commands.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/webdriver_logger.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/webdriver_proxy.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/angular_wait_barrier.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/highlight_delay_barrier.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/blockingproxy.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/client.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/blocking-proxy/built/lib/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/remote.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/http.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/chrome.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/edge.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/firefox.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/ie.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/opera.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/safari.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/selenium-webdriver/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/webdriver-js-extender/built/lib/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/protractor/built/debugger.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/protractor/built/locators.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/protractor/built/element.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/protractor/built/expectedConditions.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/@types/q/index.d.ts', 'c:/Users/ikilinc/Documents/Repos/TUI-NPC/rep/tui-wls-web-backoffice/node_modules/protractor/built/config.d.ts', ... 1493 more items ] } [Error - 10:55:55] Connection to server got closed. Server will not be restarted.

I downgrade to the last working version now.

Do you have any typescript plugin defined in tsconfig.json? ex:

    "compilerOptions": {
        "plugins": [{ "name": "sample-ts-plugin" }]
    }

my tsconfig.json file

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types",
      "src/ts-definitons"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "strictNullChecks": true
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "disableTypeScriptVersionCheck": true
  }
}

ayazhafiz edit: formatting

i thought the error comes from the ts version 3.7.5, normaly i have to use version below 3.7, due to angular cli have dependency on < 3.7, but older version of language server ( 0.900.4.) and ts 3.7.5 works too.

commented

Could you post a link to the entire contents of your log file?

@ikilinc, Could you try to use 9.0.0-rc.11 version of @angular/language-service:

npm install @angular/language-service@9.0.0-rc.11 --save-dev
or
yarn add @angular/language-service@9.0.0-rc.11 --dev

@ayazhafiz, there is a bug in the language server. It uses local typescript and @angular/language-service packages when using "typescript.tsdk": "node_modules\\typescript\\lib" setting.
image

commented

I believe this is intentional; the language service prioritizes the version specified by typescript.tsdk:

function getProbeLocations(configValue: string|null, bundled: string): string[] {
const locations = [];
// Always use config value if it's specified
if (configValue) {
locations.push(configValue);
}
// Prioritize the bundled version
locations.push(bundled);
// Look in workspaces currently open
const workspaceFolders = vscode.workspace.workspaceFolders || [];
for (const folder of workspaceFolders) {
locations.push(folder.uri.fsPath);
}
return locations;
}

The language service version is the one bundled by the extension, which is also prioritized. Maybe there is a TS version mismatch.

The extension has @angular/language-service@9.0.0-rc.11 and the workspace has @angular/language-service@8.2.14. Angular language server tries to load 9.0.0-rc.11 version because version 8.2.14 is too low. This is expected behavior.

But typescript actually loads 8.2.14 version from workspace directory. It's related to microsoft/TypeScript#34616 and #448
image

commented

I see what you are saying. What is the version of TS being used? If it is above the one in microsoft/TypeScript#34616, the bundled (>9.0.0) version of the language service should be found by tsserver anyway.

I'm using typescript 3.7.5 but the search logic changed in v3.8-beta

commented

Thank you @andrius-pra for confirming that the change landed only in v3.8.
So in short, either uninstall @angular/language-service from the project (recommended), or update the version to the latest beta.

Thanks you @kyliau @andrius-pra @ayazhafiz .

I have updated @angular/language-service to the latest version rc12 and after npm install and restart vscode > reload window. It works like a charm.

But this behavior can be little confusing because angular cli generates package.json with @angular/language-service with a specific version. Thats means all project with angular8 and ts below < 3.8 will have this issue ?

commented

Yes, projects with a dependency on angular/language-service that is less than the most recent version or using TS below 3.8 will have this issue.

i will close this issue than, but i would like to see a warning maybe in README.txt to pointing out this issue.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.