Merge pull request #373 from Numkil/patch-1
Allow easier overriding of default filetypes for LSP
This commit is contained in:
		
						commit
						ea028fe0b5
					
				
							
								
								
									
										7
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										7
									
								
								init.lua
								
								
								
								
							| 
						 | 
					@ -424,12 +424,16 @@ end
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
--  Add any additional override configuration in the following tables. They will be passed to
 | 
					--  Add any additional override configuration in the following tables. They will be passed to
 | 
				
			||||||
--  the `settings` field of the server config. You must look up that documentation yourself.
 | 
					--  the `settings` field of the server config. You must look up that documentation yourself.
 | 
				
			||||||
 | 
					--
 | 
				
			||||||
 | 
					--  If you want to override the default filetypes that your language server will attach to you can
 | 
				
			||||||
 | 
					--  define the property 'filetypes' to the map in question.
 | 
				
			||||||
local servers = {
 | 
					local servers = {
 | 
				
			||||||
  -- clangd = {},
 | 
					  -- clangd = {},
 | 
				
			||||||
  -- gopls = {},
 | 
					  -- gopls = {},
 | 
				
			||||||
  -- pyright = {},
 | 
					  -- pyright = {},
 | 
				
			||||||
  -- rust_analyzer = {},
 | 
					  -- rust_analyzer = {},
 | 
				
			||||||
  -- tsserver = {},
 | 
					  -- tsserver = {},
 | 
				
			||||||
 | 
					  -- html = { filetypes = { 'html', 'twig', 'hbs'} },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lua_ls = {
 | 
					  lua_ls = {
 | 
				
			||||||
    Lua = {
 | 
					    Lua = {
 | 
				
			||||||
| 
						 | 
					@ -459,8 +463,9 @@ mason_lspconfig.setup_handlers {
 | 
				
			||||||
      capabilities = capabilities,
 | 
					      capabilities = capabilities,
 | 
				
			||||||
      on_attach = on_attach,
 | 
					      on_attach = on_attach,
 | 
				
			||||||
      settings = servers[server_name],
 | 
					      settings = servers[server_name],
 | 
				
			||||||
 | 
					      filetypes = servers[server_name].filetypes,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  end,
 | 
					  end
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- [[ Configure nvim-cmp ]]
 | 
					-- [[ Configure nvim-cmp ]]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue