Skip to content

hedengran/fga.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fga.nvim

Neovim support for OpenFGA authorization models (.fga files).

Features

  • Filetype detection
  • Syntax highlighting (basic vim syntax, or tree-sitter)
  • LSP support (diagnostics, hover, etc.)
  • Comment toggling (gcc)

Installation

-- lazy.nvim
{
    "hedengran/fga.nvim",
    opts = {
        -- install_treesitter_grammar = true,
        -- lsp_cmd = { "node", "/path/to/vscode-ext/server/out/server.node.js", "--stdio" },
    },
}

Tree-sitter

Requires Neovim >= 0.9. The parser is compiled and cached automatically on first use (requires git and a C compiler).

opts = {
    install_treesitter_grammar = true,
}

Uses matoous/tree-sitter-fga.

Note: On Neovim < 0.9, basic syntax highlighting via syntax/fga.lua is still available without tree-sitter.

LSP

On Neovim >= 0.11, LSP works natively with no extra plugins. On older versions, nvim-lspconfig is required.

The LSP server comes from the OpenFGA VSCode extension:

git clone https://github.com/openfga/vscode-ext
cd vscode-ext
npm install && npm run compile

Then point to it with lsp_cmd:

opts = {
    lsp_cmd = { "node", "/path/to/vscode-ext/server/out/server.node.js", "--stdio" },
}

If you have the server available as an executable on your $PATH, you can pass it directly:

opts = {
    lsp_cmd = { "openfga-lsp", "--stdio" },
}

License

MIT

About

Neovim plugin for OpenFGA modeling language support

Resources

License

Stars

10 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors