Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

tsserver can't find root directory #585

Closed
1 task done
zakissimo opened this issue Apr 10, 2022 · 2 comments
Closed
1 task done

tsserver can't find root directory #585

zakissimo opened this issue Apr 10, 2022 · 2 comments

Comments

@zakissimo
Copy link

zakissimo commented Apr 10, 2022

Problem description

The typescript-language-server doesn't start when opening a simple javascript file.
:LspInfo

image

When lunched with coc it works as intended. Which leads me to believe the problem is related with nvim-lsp-installer

Neovim version (>= 0.6)

NVIM v0.7.0-dev+1395-ge135adcb8
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system/version

Linux desk 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

  • Yes

Affected language servers

tsserver

Steps to reproduce

  1. Start with minimal config
  2. Install tsserver

Actual behavior

image

Expected behavior

I expect the root folder to be found.

LspInfo

 Language client log: /home/zak/.cache/nvim/lsp.log
 Detected filetype:   javascript
 
 2 client(s) attached to this buffer: 
 
 Client: null-ls (id: 1, pid: 5001, bufnr: [6])
 	filetypes:       sh, lua, python, css, typescript, typescriptreact, javascript, javascriptreact
 	autostart:       false
 	root directory:  /home/zak/programing/www/flag
 	cmd:             nvim
 
 Client: quick_lint_js (id: 2, pid: 61501, bufnr: [6])
 	filetypes:       javascript
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             quick-lint-js --lsp-server
 
 Other clients that match the filetype: javascript
 
 Config: tsserver
 	filetypes:         javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx
 	root directory:    NA
 	cmd:               typescript-language-server --stdio
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: bashls, sumneko_lua, cmake, jsonls, vimls, html, tsserver, quick_lint_js

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **javac**: not available
  - WARNING: **julia**: not available
  - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
  - OK: **python3_host_prog**: `Python 3.10.4`
  - OK: **tar**: `tar (GNU tar) 1.34`
  - OK: **gzip**: `gzip 1.12`
  - OK: **curl**: `curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1n zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0`
  - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
  - OK: **python3**: `Python 3.10.4`
  - OK: **node**: `v17.9.0`
  - OK: **Go**: `go version go1.18 linux/amd64`
  - OK: **sh**: `Ok`
  - OK: **java**: `Ok`
  - OK: **npm**: `8.5.5`
  - OK: **pip3**: `pip 22.0.4 from /usr/lib/python3.10/site-packages/pip (python 3.10)`
@zakissimo
Copy link
Author

Solved by running
npm install typescript-language-server ts-server
But why do I need to install them manually ?

@williamboman
Copy link
Owner

It seems like lspconfig is unable to find a root directory (workspace) to start the server in (see :h lspconfig-root-dir). By doing npm install typescript-language-server ts-server, it will (among other things) create a package.json file in your current directory. As a direct result of this, lspconfig will now be able to find a root directory!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants