Skip to content

Commit

Permalink
feat(plug): pmizio/typescript-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Mar 5, 2024
1 parent 4541250 commit 91656da
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
12 changes: 6 additions & 6 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,6 @@
"rev": "c2a9e81699021f4ccaac7c574cc42ca4211a499a",
"type": "git"
},
"neodev.nvim": {
"branch": "main",
"repo": "[email protected]:folke/neodev.nvim",
"rev": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4",
"type": "git"
},
"nui.nvim": {
"branch": "main",
"repo": "[email protected]:muniftanjim/nui.nvim",
Expand Down Expand Up @@ -473,6 +467,12 @@
"rev": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4",
"type": "git"
},
"typescript-tools.nvim": {
"branch": "master",
"repo": "[email protected]:pmizio/typescript-tools.nvim",
"rev": "c43d9580c3ff5999a1eabca849f807ab33787ea7",
"type": "git"
},
"vim-abolish": {
"branch": "master",
"repo": "[email protected]:tpope/vim-abolish",
Expand Down
63 changes: 34 additions & 29 deletions plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ return function()
-- Generic lsp configuration
--

local on_init = function(client)
local function on_init(client)
client.config.flags = client.config.flags or {}
client.config.flags.allow_incremental_sync = true
end
Expand All @@ -60,7 +60,7 @@ return function()

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"

Expand Down Expand Up @@ -98,7 +98,7 @@ return function()
end,
{ buffer = bufnr, desc = "Format" },
},
["<leader><leader>l"] = {
["<leader><leader>d"] = {
vim.diagnostic.open_float,
{ buffer = bufnr, desc = "Line diagnostics" },
},
Expand Down Expand Up @@ -331,7 +331,7 @@ return function()
end
end

table.insert(library, require("neodev.config").types())
-- table.insert(library, require("neodev.config").types())

add "$VIMRUNTIME"

Expand Down Expand Up @@ -376,34 +376,39 @@ return function()
}
end

lspconfig.tsserver.setup {
-- lspconfig.tsserver.setup {
-- on_init = on_init,
-- on_attach = on_attach,
-- capabilities = updated_capabilities,
-- settings = {
-- javascript = {
-- inlayHints = {
-- includeInlayEnumMemberValueHints = true,
-- includeInlayFunctionLikeReturnTypeHints = true,
-- includeInlayFunctionParameterTypeHints = true,
-- includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
-- includeInlayParameterNameHintsWhenArgumentMatchesName = true,
-- includeInlayPropertyDeclarationTypeHints = true,
-- includeInlayVariableTypeHints = true,
-- },
-- },
-- typescript = {
-- inlayHints = {
-- includeInlayEnumMemberValueHints = true,
-- includeInlayFunctionLikeReturnTypeHints = true,
-- includeInlayFunctionParameterTypeHints = true,
-- includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
-- includeInlayParameterNameHintsWhenArgumentMatchesName = true,
-- includeInlayPropertyDeclarationTypeHints = true,
-- includeInlayVariableTypeHints = true,
-- },
-- },
-- },
-- }
require("typescript-tools").setup {
on_init = on_init,
on_attach = on_attach,
capabilities = updated_capabilities,
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
},
}

lspconfig.yamlls.setup {
Expand Down
7 changes: 3 additions & 4 deletions plugins/spec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,6 @@ in rec {
clangd_extensions = {
src = sources."clangd_extensions.nvim";
};
neodev = {
src = sources."neodev.nvim";
};
null-ls = {
src = sources."null-ls.nvim";
dependencies = {
Expand Down Expand Up @@ -328,6 +325,9 @@ in rec {
schemastore = {
src = sources."SchemaStore.nvim";
};
typescript-tools = {
src = sources."typescript-tools.nvim";
};
};
paths = with pkgs; [
alejandra # used by nil for formatting
Expand All @@ -342,7 +342,6 @@ in rec {
marksman
nodePackages.graphql-language-service-cli
nodePackages.pyright
nodePackages.typescript-language-server
nodePackages.vscode-json-languageserver
nodePackages.yaml-language-server
ruff-lsp
Expand Down

0 comments on commit 91656da

Please sign in to comment.