carbon.lua 738 B

12345678910111213141516171819202122232425262728
  1. -- Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. -- Exceptions. See /LICENSE for license information.
  3. -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. vim.filetype.add({
  5. extension = {
  6. carbon = 'carbon',
  7. },
  8. })
  9. vim.treesitter.language.add("carbon")
  10. -- LSP
  11. local lsp = require 'lspconfig'
  12. local configs = require 'lspconfig.configs'
  13. local util = require 'lspconfig.util'
  14. -- Check if the config is already defined (useful when reloading this file)
  15. if not configs.carbon then
  16. configs.carbon = {
  17. default_config = {
  18. cmd = { "./bazel-bin/language_server/language_server" },
  19. filetypes = { "carbon" },
  20. root_dir = util.find_git_ancestor,
  21. }
  22. }
  23. end
  24. lsp.carbon.setup {}