-
-
Notifications
You must be signed in to change notification settings - Fork 216
languages/fish: init #1107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
poseidon-rises
wants to merge
3
commits into
NotAShelf:main
Choose a base branch
from
poseidon-rises:languages/fish
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+117
−0
Open
languages/fish: init #1107
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ in { | |
| ./clojure.nix | ||
| ./css.nix | ||
| ./elixir.nix | ||
| ./fish.nix | ||
| ./fsharp.nix | ||
| ./gleam.nix | ||
| ./go.nix | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| { | ||
| config, | ||
| pkgs, | ||
| lib, | ||
| ... | ||
| }: | ||
| let | ||
| inherit (builtins) attrNames; | ||
| inherit (lib.meta) getExe; | ||
| inherit (lib.options) mkEnableOption mkOption; | ||
| inherit (lib.modules) mkIf mkMerge; | ||
| inherit (lib.types) enum package listOf; | ||
| inherit (lib.nvim.types) mkGrammarOption; | ||
| inherit (lib.nvim.attrsets) mapListToAttrs; | ||
|
|
||
| cfg = config.vim.languages.fish; | ||
|
|
||
| defaultServers = [ "fish-lsp" ]; | ||
| servers = { | ||
| fish-lsp = { | ||
| cmd = [ | ||
| (getExe pkgs.fish-lsp) | ||
| "start" | ||
| ]; | ||
| filetypes = [ "fish" ]; | ||
| root_markers = [ | ||
| "config.fish" | ||
| ".git" | ||
| ]; | ||
| }; | ||
| }; | ||
|
|
||
| defaultFormat = [ "fish_indent" ]; | ||
| formats = { | ||
| fish_indent = { | ||
| package = pkgs.fish; | ||
| config.command = "${cfg.format.package}/bin/fish_indent"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will break if any other formatter is used in the future. use |
||
| }; | ||
| }; | ||
| in | ||
| { | ||
| options.vim.languages.fish = { | ||
| enable = mkEnableOption "Fish language support"; | ||
| treesitter = { | ||
| enable = mkEnableOption "Fish treesitter support" // { | ||
| default = config.vim.languages.enableTreesitter; | ||
| }; | ||
| package = mkGrammarOption pkgs "fish"; | ||
| }; | ||
|
|
||
| lsp = { | ||
| enable = mkEnableOption "Fish LSP support" // { | ||
| default = config.vim.lsp.enable; | ||
| }; | ||
| servers = mkOption { | ||
| type = listOf (enum (attrNames servers)); | ||
| default = defaultServers; | ||
| description = "Fish LSP server to use"; | ||
| }; | ||
| }; | ||
|
|
||
| format = { | ||
| enable = mkEnableOption "Fish formatting" // { | ||
| default = config.vim.languages.enableFormat; | ||
| }; | ||
|
|
||
| type = mkOption { | ||
| type = listOf (enum (attrNames formats)); | ||
| default = defaultFormat; | ||
| description = "Fish formatter to use"; | ||
| }; | ||
|
|
||
| package = mkOption { | ||
| type = package; | ||
| default = formats.${cfg.format.type}.package; | ||
| description = "Fish formatter package"; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| config = mkIf cfg.enable (mkMerge [ | ||
| (mkIf cfg.treesitter.enable { | ||
| vim.treesitter = { | ||
| enable = true; | ||
| grammars = [ cfg.treesitter.package ]; | ||
| }; | ||
| }) | ||
|
|
||
| (mkIf cfg.lsp.enable { | ||
| vim.lsp.servers = mapListToAttrs (n: { | ||
| name = n; | ||
| value = servers.${n}; | ||
| }) cfg.lsp.servers; | ||
| }) | ||
|
|
||
| (mkIf (cfg.format.enable && !cfg.lsp.enable) { | ||
| vim.formatter.conform-nvim = { | ||
| enable = true; | ||
| setupOpts.formatters_by_ft.fish = cfg.format.type; | ||
| setupOpts.formatters = mapListToAttrs (name: { | ||
| inherit name; | ||
| value = formats.${name}; | ||
| }) cfg.format.type; | ||
| }; | ||
| }) | ||
| ]); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSPs now live under
lsp/presets/<name>you should prolly rebase to latest main, and look at other modules and lsps