lopi-py / luau-lsp.nvim

A luau-lsp extension to improve your experience in neovim.
MIT License
46 stars 10 forks source link

Trying to use without Roblox #2

Closed BenMcAvoy closed 1 year ago

BenMcAvoy commented 1 year ago

image

I have Rojo installed. I don't have Roblox installed as I'm on linux and I don't want to have anything to do with Roblox at all, just raw Luau. How can I achieve this?

image

It seems to at least work for the most part ignoring the errors.

Here is my lspconfig:

local masonlsp = require("mason-lspconfig")

masonlsp.setup()

masonlsp.setup_handlers {
  luau_lsp = function()
    require("luau-lsp").setup {
      server = { -- options passed to `require("lspconfig").luau_lsp.setup`
        filetypes = { "lua", "luau" }, -- default is { "luau" }
        settings = {
          types = {
            roblox = false,
          }
        },
      },
    }
  end,
}

local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities

local lspconfig = require "lspconfig"

local servers = { "html", "cssls", "tsserver", "clangd", "rust_analyzer" }

for _, lsp in ipairs(servers) do
  lspconfig[lsp].setup {
    on_attach = on_attach,
    capabilities = capabilities,
  }
end
lopi-py commented 1 year ago

Note that roblox related settings are not server specific, check the readme, you should do like this:

require("luau-lsp").setup {
  sourcemap = {
    enable = false, -- disable sourcemap generation (rojo)
  },
  types = {
    roblox = false, -- disable roblox api
  },
}
lopi-py commented 1 year ago

Just in case, for future issues, seems like your rojo version is some old and does not support --watch flag on sourcemap command

BenMcAvoy commented 1 year ago

I installed it with cargo install rojo --version ^7 (it's not in my repos) so is that an outdated version? It's what was on the docs

rojo --version reports Rojo 7.2.1

BenMcAvoy commented 1 year ago

Another question I have is why rojo is required. If I'm doing nothing to do with Roblox, what is it used for?

lopi-py commented 1 year ago

Rojo is not required at all, you had the incorrect settings, check my previous comments so you can set it up properly and no longer depend of rojo

BenMcAvoy commented 1 year ago

Oh I see, I forgot the sourcemap disable. Thanks so much! Sorry for being stupid :sweat_smile: