mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	Merge branch 'main' into live-docs-preview
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Check for typos in the source tree / check-typos (push) Has been cancelled
				
			
		
		
	
	
		
	
		
			Some checks failed
		
		
	
	Check for typos in the source tree / check-typos (push) Has been cancelled
				
			This commit is contained in:
		
				commit
				
					
						5ce1d90e95
					
				
			
		
					 9 changed files with 174 additions and 20 deletions
				
			
		|  | @ -79,6 +79,7 @@ isMaximal: { | ||||||
|       dart.enable = false; |       dart.enable = false; | ||||||
|       ocaml.enable = false; |       ocaml.enable = false; | ||||||
|       elixir.enable = false; |       elixir.enable = false; | ||||||
|  |       haskell.enable = false; | ||||||
| 
 | 
 | ||||||
|       tailwind.enable = false; |       tailwind.enable = false; | ||||||
|       svelte.enable = false; |       svelte.enable = false; | ||||||
|  |  | ||||||
|  | @ -8,3 +8,9 @@ | ||||||
|   `languages.typst.extensions.typst-preview-nvim`. |   `languages.typst.extensions.typst-preview-nvim`. | ||||||
| 
 | 
 | ||||||
| - Add a search widget to the options page in the nvf manual. | - Add a search widget to the options page in the nvf manual. | ||||||
|  | 
 | ||||||
|  | [amadaluzia](https://github.com/amadaluzia): | ||||||
|  | 
 | ||||||
|  | [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim | ||||||
|  | 
 | ||||||
|  | - Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim] | ||||||
|  |  | ||||||
							
								
								
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							|  | @ -684,6 +684,22 @@ | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |     "plugin-haskell-tools-nvim": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1734222260, | ||||||
|  |         "narHash": "sha256-gZVN9ADPO5wFOaf19FydCneb7aKTT9K1vcLoBURPEjk=", | ||||||
|  |         "owner": "mrcjkb", | ||||||
|  |         "repo": "haskell-tools.nvim", | ||||||
|  |         "rev": "943b77b68a79d3991523ba4d373063c9355c6f55", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "mrcjkb", | ||||||
|  |         "repo": "haskell-tools.nvim", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     "plugin-highlight-undo": { |     "plugin-highlight-undo": { | ||||||
|       "flake": false, |       "flake": false, | ||||||
|       "locked": { |       "locked": { | ||||||
|  | @ -2091,6 +2107,7 @@ | ||||||
|         "plugin-gitsigns-nvim": "plugin-gitsigns-nvim", |         "plugin-gitsigns-nvim": "plugin-gitsigns-nvim", | ||||||
|         "plugin-glow-nvim": "plugin-glow-nvim", |         "plugin-glow-nvim": "plugin-glow-nvim", | ||||||
|         "plugin-gruvbox": "plugin-gruvbox", |         "plugin-gruvbox": "plugin-gruvbox", | ||||||
|  |         "plugin-haskell-tools-nvim": "plugin-haskell-tools-nvim", | ||||||
|         "plugin-highlight-undo": "plugin-highlight-undo", |         "plugin-highlight-undo": "plugin-highlight-undo", | ||||||
|         "plugin-hop-nvim": "plugin-hop-nvim", |         "plugin-hop-nvim": "plugin-hop-nvim", | ||||||
|         "plugin-icon-picker-nvim": "plugin-icon-picker-nvim", |         "plugin-icon-picker-nvim": "plugin-icon-picker-nvim", | ||||||
|  |  | ||||||
|  | @ -720,5 +720,10 @@ | ||||||
|       url = "github:otavioschwanck/new-file-template.nvim"; |       url = "github:otavioschwanck/new-file-template.nvim"; | ||||||
|       flake = false; |       flake = false; | ||||||
|     }; |     }; | ||||||
|  | 
 | ||||||
|  |     plugin-haskell-tools-nvim = { | ||||||
|  |       url = "github:mrcjkb/haskell-tools.nvim"; | ||||||
|  |       flake = false; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ in { | ||||||
|     ./hcl.nix |     ./hcl.nix | ||||||
|     ./kotlin.nix |     ./kotlin.nix | ||||||
|     ./html.nix |     ./html.nix | ||||||
|  |     ./haskell.nix | ||||||
|     ./java.nix |     ./java.nix | ||||||
|     ./lua.nix |     ./lua.nix | ||||||
|     ./markdown.nix |     ./markdown.nix | ||||||
|  |  | ||||||
							
								
								
									
										104
									
								
								modules/plugins/languages/haskell.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								modules/plugins/languages/haskell.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,104 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (builtins) isList; | ||||||
|  |   inherit (lib.types) either package listOf str; | ||||||
|  |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|  |   inherit (lib.strings) optionalString; | ||||||
|  |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.nvim.types) mkGrammarOption; | ||||||
|  |   inherit (lib.nvim.dag) entryAfter; | ||||||
|  |   inherit (lib.nvim.lua) expToLua; | ||||||
|  |   inherit (pkgs) haskellPackages; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.languages.haskell; | ||||||
|  | in { | ||||||
|  |   options.vim.languages.haskell = { | ||||||
|  |     enable = mkEnableOption "Haskell support"; | ||||||
|  | 
 | ||||||
|  |     treesitter = { | ||||||
|  |       enable = mkEnableOption "Treesitter support for Haskell" // {default = config.vim.languages.enableTreesitter;}; | ||||||
|  |       package = mkGrammarOption pkgs "haskell"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     lsp = { | ||||||
|  |       enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;}; | ||||||
|  |       package = mkOption { | ||||||
|  |         description = "Haskell LSP package or command to run the Haskell LSP"; | ||||||
|  |         example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]''; | ||||||
|  |         default = haskellPackages.haskell-language-server; | ||||||
|  |         type = either package (listOf str); | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     dap = { | ||||||
|  |       enable = mkEnableOption "DAP support for Haskell" // {default = config.vim.languages.enableDAP;}; | ||||||
|  |       package = mkOption { | ||||||
|  |         description = "Haskell DAP package or command to run the Haskell DAP"; | ||||||
|  |         default = haskellPackages.haskell-debug-adapter; | ||||||
|  |         type = either package (listOf str); | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = mkIf cfg.enable (mkMerge [ | ||||||
|  |     (mkIf cfg.treesitter.enable { | ||||||
|  |       vim.treesitter = { | ||||||
|  |         enable = true; | ||||||
|  |         grammars = [cfg.treesitter.package]; | ||||||
|  |       }; | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|  |     (mkIf (cfg.dap.enable || cfg.lsp.enable) { | ||||||
|  |       vim = { | ||||||
|  |         startPlugins = ["haskell-tools-nvim"]; | ||||||
|  |         luaConfigRC.haskell-tools-nvim = | ||||||
|  |           entryAfter | ||||||
|  |           ["lsp-setup"] | ||||||
|  |           '' | ||||||
|  |             vim.g.haskell_tools = { | ||||||
|  |             ${optionalString cfg.lsp.enable '' | ||||||
|  |               -- LSP | ||||||
|  |               tools = { | ||||||
|  |                 hover = { | ||||||
|  |                   enable = true, | ||||||
|  |                 }, | ||||||
|  |               }, | ||||||
|  |               hls = { | ||||||
|  |                 cmd = ${ | ||||||
|  |                 if isList cfg.lsp.package | ||||||
|  |                 then expToLua cfg.lsp.package | ||||||
|  |                 else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}'' | ||||||
|  |               }, | ||||||
|  |                 on_attach = function(client, bufnr, ht) | ||||||
|  |                   default_on_attach(client, bufnr, ht) | ||||||
|  |                   local opts = { noremap = true, silent = true, buffer = bufnr } | ||||||
|  |                   vim.keymap.set('n', '<localleader>cl', vim.lsp.codelens.run, opts) | ||||||
|  |                   vim.keymap.set('n', '<localleader>hs', ht.hoogle.hoogle_signature, opts) | ||||||
|  |                   vim.keymap.set('n', '<localleader>ea', ht.lsp.buf_eval_all, opts) | ||||||
|  |                   vim.keymap.set('n', '<localleader>rr', ht.repl.toggle, opts) | ||||||
|  |                   vim.keymap.set('n', '<localleader>rf', function() | ||||||
|  |                     ht.repl.toggle(vim.api.nvim_buf_get_name(0)) | ||||||
|  |                   end, opts) | ||||||
|  |                   vim.keymap.set('n', '<localleader>rq', ht.repl.quit, opts) | ||||||
|  |                 end, | ||||||
|  |               }, | ||||||
|  |             ''} | ||||||
|  |             ${optionalString cfg.dap.enable '' | ||||||
|  |               dap = { | ||||||
|  |                 cmd = ${ | ||||||
|  |                 if isList cfg.dap.package | ||||||
|  |                 then expToLua cfg.dap.package | ||||||
|  |                 else ''${cfg.dap.package}/bin/haskell-debug-adapter'' | ||||||
|  |               }, | ||||||
|  |               }, | ||||||
|  |             ''} | ||||||
|  |             } | ||||||
|  |           ''; | ||||||
|  |       }; | ||||||
|  |     }) | ||||||
|  |   ]); | ||||||
|  | } | ||||||
|  | @ -13,7 +13,7 @@ | ||||||
|   inherit (lib.types) bool package str listOf either enum; |   inherit (lib.types) bool package str listOf either enum; | ||||||
|   inherit (lib.nvim.types) mkGrammarOption; |   inherit (lib.nvim.types) mkGrammarOption; | ||||||
|   inherit (lib.nvim.lua) expToLua; |   inherit (lib.nvim.lua) expToLua; | ||||||
|   inherit (lib.nvim.dag) entryAnywhere; |   inherit (lib.nvim.dag) entryAfter entryAnywhere; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.languages.rust; |   cfg = config.vim.languages.rust; | ||||||
| 
 | 
 | ||||||
|  | @ -127,7 +127,7 @@ in { | ||||||
|       vim = { |       vim = { | ||||||
|         startPlugins = ["rustaceanvim"]; |         startPlugins = ["rustaceanvim"]; | ||||||
| 
 | 
 | ||||||
|         luaConfigRC.rustaceanvim = entryAnywhere '' |         pluginRC.rustaceanvim = entryAfter ["lsp-setup"] '' | ||||||
|           vim.g.rustaceanvim = { |           vim.g.rustaceanvim = { | ||||||
|           ${optionalString cfg.lsp.enable '' |           ${optionalString cfg.lsp.enable '' | ||||||
|             -- LSP |             -- LSP | ||||||
|  |  | ||||||
|  | @ -23,8 +23,11 @@ | ||||||
|       package = pkgs.typescript-language-server; |       package = pkgs.typescript-language-server; | ||||||
|       lspConfig = '' |       lspConfig = '' | ||||||
|         lspconfig.ts_ls.setup { |         lspconfig.ts_ls.setup { | ||||||
|           capabilities = capabilities; |           capabilities = capabilities, | ||||||
|           on_attach = attach_keymaps, |           on_attach = function(client, bufnr) | ||||||
|  |             attach_keymaps(client, bufnr); | ||||||
|  |             client.server_capabilities.documentFormattingProvider = false; | ||||||
|  |           end, | ||||||
|           cmd = ${ |           cmd = ${ | ||||||
|           if isList cfg.lsp.package |           if isList cfg.lsp.package | ||||||
|           then expToLua cfg.lsp.package |           then expToLua cfg.lsp.package | ||||||
|  | @ -79,6 +82,7 @@ | ||||||
|           ls_sources, |           ls_sources, | ||||||
|           null_ls.builtins.formatting.prettier.with({ |           null_ls.builtins.formatting.prettier.with({ | ||||||
|             command = "${cfg.format.package}/bin/prettier", |             command = "${cfg.format.package}/bin/prettier", | ||||||
|  |             filetypes = { "typescript" }, | ||||||
|           }) |           }) | ||||||
|         ) |         ) | ||||||
|       ''; |       ''; | ||||||
|  |  | ||||||
|  | @ -126,16 +126,14 @@ in { | ||||||
| 
 | 
 | ||||||
|       example = {"some_variable" = 42;}; |       example = {"some_variable" = 42;}; | ||||||
|       description = '' |       description = '' | ||||||
|         An attribute set containing global variable values |         A freeform attribute set containing global variable values for setting vim | ||||||
|         for storing vim variables as early as possible. If |         variables as early as possible. If populated, this option will set vim variables | ||||||
|         populated, this option will set vim variables in the |         in the built {option}`luaConfigRC` as the first item. | ||||||
|         built luaConfigRC as the first item. |  | ||||||
| 
 | 
 | ||||||
|         ::: {.note} |         ::: {.note} | ||||||
|         `{foo = "bar";}` will set `vim.g.foo` to "bar", where |         `{foo = "bar";}` will set `vim.g.foo` to "bar", where the type of `bar` in the | ||||||
|         the type of `bar` in the resulting Lua value will be |         resulting Lua value will be inferred from the type of the value in the | ||||||
|         inferred from the type of the value in the `{name = value;}` |         `{name = value;}` pair passed to the option. | ||||||
|         pair passed to the option. |  | ||||||
|         ::: |         ::: | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|  | @ -212,21 +210,39 @@ in { | ||||||
|             default = true; |             default = true; | ||||||
|             description = "Enable word wrapping."; |             description = "Enable word wrapping."; | ||||||
|           }; |           }; | ||||||
|  | 
 | ||||||
|  |           tabstop = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 8; # Neovim default | ||||||
|  |             description = '' | ||||||
|  |               Number of spaces that a `<Tab>` in the file counts for. Also see | ||||||
|  |               the {command}`:retab` command, and the {option}`softtabstop` option. | ||||||
|  |             ''; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           shiftwidth = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 8; # Neovim default | ||||||
|  |             description = '' | ||||||
|  |               Number of spaces to use for each step of (auto)indent. Used for | ||||||
|  |               {option}`cindent`, `>>`, `<<`, etc. | ||||||
|  | 
 | ||||||
|  |               When zero the {option}`tabstop` value will be used. | ||||||
|  |             ''; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       example = {visualbell = true;}; |       example = {visualbell = true;}; | ||||||
|       description = '' |       description = '' | ||||||
|         An attribute set containing vim options to be set |         A freeform attribute set containing vim options to be set as early as possible. | ||||||
|         as early as possible. If populated, this option will |         If populated, this option will set vim options in the built {option}`luaConfigRC` | ||||||
|         set vim options in the built luaConfigRC after `basic` |         after `basic` and before `pluginConfigs` DAG entries. | ||||||
|         and before `pluginConfigs` DAG entries. |  | ||||||
| 
 | 
 | ||||||
|         ::: {.note} |         ::: {.note} | ||||||
|         `{foo = "bar";}` will set `vim.o.foo` to "bar", where |         `{foo = "bar";}` will set `vim.o.foo` to "bar", where the type of `bar` in the | ||||||
|         the type of `bar` in the resulting Lua value will be |         resulting Lua value will be inferred from the type of the value in the | ||||||
|         inferred from the type of the value in the`{name = value;}` |         `{name = value;}` pair passed to the option. | ||||||
|         pair passed to the option. |  | ||||||
|         ::: |         ::: | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 GitHub
					GitHub