Skip to content

Commit ba851a3

Browse files
committed
add deno tsserver config, and config for telescope to use .env
1 parent 38ebfd7 commit ba851a3

1 file changed

Lines changed: 38 additions & 10 deletions

File tree

init.lua

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,19 @@ require('lazy').setup({
286286
require('telescope').setup {
287287
-- You can put your default mappings / updates / etc. in here
288288
-- All the info you're looking for is in `:help telescope.setup()`
289-
--
290-
-- defaults = {
291-
-- mappings = {
292-
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
293-
-- },
294-
-- },
295-
-- pickers = {}
289+
defaults = {
290+
file_ignore_patterns = { '%.git/', 'node_modules/', 'dist/', 'build/' },
291+
},
292+
pickers = {
293+
find_files = {
294+
no_ignore = true,
295+
},
296+
live_grep = {
297+
additional_args = function()
298+
return { '--no-ignore' }
299+
end,
300+
},
301+
},
296302
extensions = {
297303
['ui-select'] = { require('telescope.themes').get_dropdown() },
298304
},
@@ -497,6 +503,17 @@ require('lazy').setup({
497503
-- Enable the following language servers
498504
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
499505
-- See `:help lsp-config` for information about keys and how to configure
506+
local util = require 'lspconfig.util'
507+
508+
local function root_dir_from_pattern(...)
509+
local matcher = util.root_pattern(...)
510+
return function(bufnr, on_dir)
511+
local fname = vim.api.nvim_buf_get_name(bufnr)
512+
local root = matcher(fname)
513+
if root then on_dir(root) end
514+
end
515+
end
516+
500517
---@type table<string, vim.lsp.Config>
501518
local servers = {
502519
-- clangd = {},
@@ -508,9 +525,16 @@ require('lazy').setup({
508525
-- https://github.com/pmizio/typescript-tools.nvim
509526
--
510527
-- But for many setups, the LSP (`ts_ls`) will work just fine
511-
ts_ls = {},
528+
ts_ls = {
529+
root_dir = root_dir_from_pattern('package.json', 'tsconfig.json', 'jsconfig.json'),
530+
single_file_support = false,
531+
},
512532

513-
stylua = {}, -- Used to format Lua code
533+
-- Use Deno's built-in language server when deno configuration files are present
534+
denols = {
535+
root_dir = root_dir_from_pattern('deno.json', 'deno.jsonc'),
536+
single_file_support = false,
537+
},
514538

515539
-- Special Lua Config, as recommended by neovim help docs
516540
lua_ls = {
@@ -549,9 +573,13 @@ require('lazy').setup({
549573
-- :Mason
550574
--
551575
-- You can press `g?` for help in this menu.
552-
local ensure_installed = vim.tbl_keys(servers or {})
576+
local ensure_installed = {}
577+
for server_name in pairs(servers or {}) do
578+
if server_name ~= 'denols' then table.insert(ensure_installed, server_name) end
579+
end
553580
vim.list_extend(ensure_installed, {
554581
-- You can add other tools here that you want Mason to install
582+
'stylua',
555583
})
556584

557585
require('mason-tool-installer').setup { ensure_installed = ensure_installed }

0 commit comments

Comments
 (0)