emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.76k stars 871 forks source link

Angular-ls has no knowledge of wider project #4499

Open JordanAnthonyKing opened 1 month ago

JordanAnthonyKing commented 1 month ago

Thank you for the bug report

Bug description

Angular-ls features like code completion and go to definition aren't working for me.

I get no errors or messages in the angular-lsp buffers.

image

Angular-ls reports that all features are available.

image

The lsp-log makes no references to angular if I open an html file however after opening a ts file I get:

Command "c:/Users/jking/.config/emacs/.local/etc/lsp/npm/typescript-language-server/typescript-language-server.cmd --stdio" is present on the path.
Command "ngserver --stdio --tsProbeLocations c:/Program Files/nodejs/node_modules --ngProbeLocations c:/Program Files/nodejs/node_modules/@angular/language-server/node_modules/" is present on the path.
Command "semgrep lsp" is not present on the path.
Command "deno lsp" is not present on the path.
Command "c:/Users/jking/.config/emacs/.local/etc/lsp/npm/typescript-language-server/typescript-language-server.cmd --stdio" is present on the path.
Command "ngserver --stdio --tsProbeLocations c:/Program Files/nodejs/node_modules --ngProbeLocations c:/Program Files/nodejs/node_modules/@angular/language-server/node_modules/" is present on the path.
Found the following clients for c:/Users/jking/source/XSight/XClient/apps/location/src/app/modules/locations/components/data-providers/data-provider-popup/data-provider-popup.component.ts: (server-id ts-ls, priority -2), (server-id eslint, priority -1), (server-id angular-ls, priority -1)
The following clients were selected based on priority: (server-id ts-ls, priority -2), (server-id eslint, priority -1), (server-id angular-ls, priority -1)

Then after opening an html file I get something similar:

Command "c:/Users/jking/.config/emacs/.local/etc/lsp/npm/vscode-langservers-extracted/vscode-html-language-server.cmd --stdio" is present on the path.
Command "semgrep lsp" is not present on the path.
Command "ngserver --stdio --tsProbeLocations c:/Program Files/nodejs/node_modules --ngProbeLocations c:/Program Files/nodejs/node_modules/@angular/language-server/node_modules/" is present on the path.
Command "c:/Users/jking/.config/emacs/.local/etc/lsp/npm/vscode-langservers-extracted/vscode-html-language-server.cmd --stdio" is present on the path.
Command "semgrep lsp" is not present on the path.
Command "ngserver --stdio --tsProbeLocations c:/Program Files/nodejs/node_modules --ngProbeLocations c:/Program Files/nodejs/node_modules/@angular/language-server/node_modules/" is present on the path.
Found the following clients for c:/Users/jking/source/XSight/XClient/apps/location/src/app/modules/locations/components/data-providers/data-provider-popup/data-provider-popup.component.html: (server-id html-ls, priority -4), (server-id eslint, priority -1), (server-id angular-ls, priority -1)
The following clients were selected based on priority: (server-id html-ls, priority -4), (server-id eslint, priority -1), (server-id angular-ls, priority -1)

After this when trying to use a language server feature like completion I see this in the log:

Cancelling textDocument/codeLens(110) in hook after-change-functions
Cancelling textDocument/hover(109) in hook after-change-functions
Cancelling textDocument/codeLens(116) in hook after-change-functions
Cancelling textDocument/hover(115) in hook after-change-functions
Cancelling textDocument/diagnostic(128) in hook after-change-functions
Cancelling textDocument/diagnostic(129) in hook after-change-functions
Cancelling textDocument/diagnostic(130) in hook after-change-functions
Cancelling textDocument/codeLens(136) in hook after-change-functions
Cancelling textDocument/codeLens(143) in hook after-change-functions
Cancelling textDocument/hover(142) in hook after-change-functions
Cancelling textDocument/documentHighlight(141) in hook after-change-functions
Cancelling textDocument/documentLink(140) in hook after-change-functions
Cancelling textDocument/diagnostic(144) in hook after-change-functions
Cancelling textDocument/diagnostic(146) in hook after-change-functions
Cancelling textDocument/diagnostic(157) in hook after-change-functions
Cancelling textDocument/diagnostic(158) in hook after-change-functions
Cancelling textDocument/diagnostic(159) in hook after-change-functions

Basic completion works but there is no completion of project specific variables/functions/etc.

The only thing somewhat unusual about my project is that it's in a monorepo, but I have verified that the lsp-workspace is correct for the file I am currently editing. Evaling (lsp-workspace-root) returns the root of the angular project, not the root of the git repo.

Steps to reproduce

I've done no special config. I've installed the requirements and opened a project. However I think it's important to point out I have ignored the configuration advice given here: https://github.com/emacs-lsp/lsp-mode/wiki/Install-Angular-Language-server as according to this bug: https://github.com/emacs-lsp/lsp-mode/issues/4459 it is outdated

Expected behavior

All language features should be available

Which Language Server did you use?

Angular

OS

Windows

Error callstack

No response

Anything else?

No response

JordanAnthonyKing commented 1 month ago

I guess I should also point out that I always get these warnings too:

image

JordanAnthonyKing commented 1 month ago

Okay, this is very likely some sort of known/unknown upstream bug. Basically I was getting no results when I was editing within an <ng-container> block. Turns out everywhere else works fine.

Askath commented 1 month ago

I guess I should also point out that I always get these warnings too:

image

Getting this issue as well, in template files however after installing the html-ls server