Last active
May 24, 2024 14:43
-
-
Save renatoliveira/ad04b6f5b8459ee513acea5b7a106beb to your computer and use it in GitHub Desktop.
Nvim's Init script for setting up the Apex language server
This file contains 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
-- Get the file path to the language server file provided by Salesforce. | |
local apex_jorje_lsp_file_path = vim.fn.expand("~/Downloads/apex-jorje-lsp.jar") | |
-- Set up the language server configuration for the Apex language, associating | |
-- it with the three main file types by extension, disabling telemetry, and | |
-- specifying the command. | |
require"lspconfig".apex_ls.setup { | |
apex_jar_setup = apex_jorje_lsp_file_path, | |
apex_enable_semantic_errors = false, | |
apex_enable_completion_statistics = false, | |
filetypes = { 'cls', 'trigger', 'apex' }, | |
cmd = { | |
"java", | |
"-jar", | |
apex_jorje_lsp_file_path, | |
"apex_language_server" | |
} | |
} | |
-- Associate .cls, .trigger and .apex files with the 'apex' filetype. | |
vim.cmd("autocmd BufNewFile,BufRead,BufReadPost *.cls,*.trigger,*.apex :set filetype=apex") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works for the NvChad setup. To enable syntax highlighting for the language, use
TSInstall apex
, which is the command for the Treesitter plugin (that comes with NvChad).