I have this problem, that angularls is attached to my client, but the autocomplete / go to definition / format / hover is not working, for example if I tried to do vim.buf.hover using 'K' on '@Component' (An angular decorator), a message 'No information available' is printed.
I already installed angular language service as dev dependency in my project, and I also have logged my LSP, but I didn't see any errors. Can someone help me spot the mistake?
Plugins installed:
packer.nvim
mason.nvim
nvim-lspconfig
neodev.nvim
rust-tools.nvim
nvim-jdtls
nvim-dap
nvim-dap-ui
cmp-*
nvim-cmp
LuaSnip
cmp_luasnip
nvim-tree
nvim-lsp-file-operations
feline.nvim
telescope.nvim
nvim-treesitter
-- snipped
-- Angular
local uv = vim.loop
local function get_node_modules(root_dir)
-- return util.find_node_modules_ancestor(root_dir) .. '/node_modules' or ''
-- util.find_node_modules_ancestor()
local root_node = root_dir .. "/node_modules"
local stats = uv.fs_stat(root_node)
if stats == nil then
return ''
else
return root_node
end
end
local default_node_modules = get_node_modules(vim.fn.getcwd())
local ngls_cmd = {
"node",
"/home/me/.local/share/nvim/mason/packages/angular-language-server/node_modules/@angular/language-server/",
"--stdio",
"--tsProbeLocations",
default_node_modules,
"--ngProbeLocations",
default_node_modules,
"--includeCompletionsWithSnippetText",
"--includeAutomaticOptionalChainCompletions",
"--logToConsole",
"--logFile",
"/home/me/angularls.log",
}
lspconfig.angularls.setup {
cmd = ngls_cmd,
on_attach = on_attach,
capabilities = capabilities,
on_new_config = function(new_config, _)
new_config.cmd = ngls_cmd
end,
}
checkhealth:
==============================================================================
vim.lsp: require("vim.lsp.health").check()
- LSP log level : WARN
- Log path: /home/me/.local/state/nvim/lsp.log
- Log size: 1 KB
vim.lsp: Active Clients ~
- angularls (id=1, root_dir=/home/me/repos/devgame-neu)
Thank you!
EDIT:
angularls.log:
Info 0 [13:40:46.72] Format host information updated
Info 1 [13:40:46.73] reload projects.
Info 2 [13:40:46.73] Before ensureProjectForOpenFiles:
Info 3 [13:40:46.73] After ensureProjectForOpenFiles:
Info 4 [13:40:46.73] Host file extension mappings updated
Info 5 [13:40:46.73] Host watch options changed to {"watchFile":4,"watchDirectory":0,"fallbackPolling":2}, it will be take effect for next watches.
Info 6 [13:40:46.73] Angular language server process ID: 3760
Info 7 [13:40:46.74] Using typescript/lib/tsserverlibrary v4.9.5 from /home/me/repos/devgame-neu/node_modules/typescript/lib/tsserverlibrary.js
Info 8 [13:40:46.74] Using @angular/language-service v15.2.7 from /home/me/repos/devgame-neu/node_modules/@angular/language-service/index.js
Info 9 [13:40:46.74] Log file: /home/me/angularls.log
Info 10 [13:40:46.85] Search path: /home/me/repos/devgame-neu/src/app
Info 11 [13:40:46.86] For info: /home/me/repos/devgame-neu/src/app/app.module.ts :: Config file name: /home/sisyph0s/repos/devgame-neu/tsconfig.json
Info 12 [13:40:46.86] Creating configuration project /home/me/repos/devgame-neu/tsconfig.json
Info 13 [13:40:46.88] Loading new project: Creating possible configured project for /home/me/repos/devgame-neu/src/app/app.module.ts to open
Info 14 [13:40:46.110] Config: /home/me/repos/devgame-neu/tsconfig.json : {
"rootNames": [
"/home/me/repos/devgame-neu/src/main.ts",
"/home/me/repos/devgame-neu/src/app/app-routing.module.ts",
"/home/me/repos/devgame-neu/src/app/app.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/app.component.ts",
"/home/me/repos/devgame-neu/src/app/app.module.ts",
"/home/me/repos/devgame-neu/src/app/components/home/home.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/home.component.ts",
"/home/me/repos/devgame-neu/src/app/components/home/challenges/challenges.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/challenges/challenges.component.ts",
"/home/me/repos/devgame-neu/src/app/components/home/leaderboards/leaderboards.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/leaderboards/leaderboards.component.ts",
"/home/me/repos/devgame-neu/src/app/components/home/profile/profile.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/profile/profile.component.ts",
"/home/me/repos/devgame-neu/src/app/components/home/projects/projects.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/projects/projects.component.ts",
"/home/me/repos/devgame-neu/src/app/components/home/projects/project/project.component.spec.ts",
"/home/me/repos/devgame-neu/src/app/components/home/projects/project/project.component.ts",
"/home/me/repos/devgame-neu/src/app/handwritten-models/home-project.ts",
"/home/me/repos/devgame-neu/src/app/handwritten-models/leaderboards-entry.ts",
"/home/me/repos/devgame-neu/src/app/handwritten-models/profile.ts",
"/home/me/repos/devgame-neu/src/app/handwritten-models/quest.ts"
],
"options": {
"baseUrl": "/home/me/repos/devgame-neu",
"outDir": "/home/me/repos/devgame-neu/dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": 2,
"importHelpers": true,
"target": 9,
"module": 7,
"useDefineForClassFields": false,
"lib": [
"lib.es2022.d.ts",
"lib.dom.d.ts"
],
"configFilePath": "/home/me/repos/devgame-neu/tsconfig.json"
}
}
Info 15 [13:40:46.365] Loading global plugin @angular/language-service
Info 16 [13:40:46.365] Enabling plugin @angular/language-service from candidate paths: /home/me/repos/devgame-neu/node_modules/@angular/language-service/index.js,/home/me/repos/devgame-neu/node_modules/typescript/lib/tsserverlibrary.js/../../..
Info 17 [13:40:46.365] Loading @angular/language-service from /home/me/repos/devgame-neu/node_modules/@angular/language-service/index.js (resolved to /home/me/repos/devgame-neu/node_modules/@angular/language-service/index.js/node_modules)
Info 18 [13:40:46.520] Angular compiler options for /home/me/repos/devgame-neu/tsconfig.json: {
"baseUrl": "/home/me/repos/devgame-neu",
"outDir": "/home/me/repos/devgame-neu/dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": 2,
"importHelpers": true,
"target": 9,
"module": 7,
"useDefineForClassFields": false,
"lib": [
"lib.es2022.d.ts",
"lib.dom.d.ts"
],
"configFilePath": "/home/me/repos/devgame-neu/tsconfig.json",
"genDir": "/home/me/repos/devgame-neu",
"basePath": "/home/me/repos/devgame-neu",
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
"compileNonExportedClasses": false
}
Info 19 [13:40:46.521] Plugin validation succeeded
Info 20 [13:40:46.540] Starting updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json
Info 21 [13:40:47.836] Finishing updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed: 1295.9969760002568ms
Info 22 [13:40:47.836] Project '/home/me/repos/devgame-neu/tsconfig.json' (Configured)
Info 23 [13:40:47.836] Files (371)
Info 24 [13:40:47.836] -----------------------------------------------
Info 25 [13:40:49.52] Enabling Ivy language service for /home/me/repos/devgame-neu/tsconfig.json.
Info 26 [13:40:49.53] Starting updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json
Info 27 [13:40:49.104] Finishing updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed: 51.891818000003695ms
Info 28 [13:40:49.105] Different program with same set of files
Info 29 [13:40:49.244] Starting updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json
Info 30 [13:40:49.324] Finishing updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json Version: 3 structureChanged: true structureIsReused:: Not Elapsed: 80.09762700088322ms
Info 31 [13:40:49.324] Project '/home/me/repos/devgame-neu/tsconfig.json' (Configured)
Info 32 [13:40:49.324] Files (385)
Info 33 [13:40:49.324] -----------------------------------------------
Info 34 [13:41:25.690] Search path: /home/me/repos/devgame-neu/src/app/components/home/profile
Info 35 [13:41:25.690] For info: /home/me/repos/devgame-neu/src/app/components/home/profile/profile.component.ts :: Config file name: /home/me/repos/devgame-neu/tsconfig.json
Info 36 [13:41:25.992] Starting updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json
Info 37 [13:41:26.24] Finishing updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json Version: 4 structureChanged: false structureIsReused:: Completely Elapsed: 31.892907000146806ms
Info 38 [13:41:26.24] Different program with same set of files
Info 39 [13:41:26.115] Starting updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json
Info 40 [13:41:26.172] Finishing updateGraphWorker: Project: /home/me/repos/devgame-neu/tsconfig.json Version: 5 structureChanged: true structureIsReused:: Not Elapsed: 56.91861300077289ms
Info 41 [13:41:26.172] Project '/home/me/repos/devgame-neu/tsconfig.json' (Configured)
Info 42 [13:41:26.172] Files (386)
Info 43 [13:41:26.172] -----------------------------------------------