From 6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Wed, 24 Nov 2021 23:01:07 -0500 Subject: feat: expose configs --- lua/lspconfig/server_configurations/tsserver.lua | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lua/lspconfig/server_configurations/tsserver.lua (limited to 'lua/lspconfig/server_configurations/tsserver.lua') diff --git a/lua/lspconfig/server_configurations/tsserver.lua b/lua/lspconfig/server_configurations/tsserver.lua new file mode 100644 index 00000000..36d955b8 --- /dev/null +++ b/lua/lspconfig/server_configurations/tsserver.lua @@ -0,0 +1,58 @@ +local util = require 'lspconfig/util' + +local bin_name = 'typescript-language-server' +if vim.fn.has 'win32' == 1 then + bin_name = bin_name .. '.cmd' +end + +return { + default_config = { + init_options = { hostInfo = 'neovim' }, + cmd = { bin_name, '--stdio' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_dir = function(fname) + return util.root_pattern 'tsconfig.json'(fname) + or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname) + end, + }, + docs = { + description = [[ +https://github.com/theia-ide/typescript-language-server + +`typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: +```sh +npm install -g typescript typescript-language-server +``` + +To configure type language server, add a +[`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or +[`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your +project. + +Here's an example that disables type checking in JavaScript files. + +```json +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "checkJs": false + }, + "exclude": [ + "node_modules" + ] +} +``` +]], + default_config = { + root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + }, + }, +} -- cgit v1.2.3-70-g09d2