Skip to content

Instantly share code, notes, and snippets.

@mal1kc
Created June 14, 2025 22:22
Show Gist options
  • Save mal1kc/98f5e25c8ece5484f96004d01eebaac7 to your computer and use it in GitHub Desktop.
Save mal1kc/98f5e25c8ece5484f96004d01eebaac7 to your computer and use it in GitHub Desktop.
lsp-qmlls6.lua
-- Add checks for essential modules
local ok_lspconfig, lspconfig = pcall(require, "lspconfig")
if not ok_lspconfig then
vim.notify("Error: `lspconfig` module not found. QML LSP setup aborted.", vim.log.levels.ERROR)
return {}
end
local configs = require("lspconfig.configs")
local util = require("lspconfig.util")
if not (vim.fs and type(vim.fs.dirname) == "function") then
vim.notify("Error: 'vim.fs.dirname' function not available. QML LSP setup aborted.", vim.log.levels.ERROR)
return {}
end
local root_files = { "shell.qml" }
if not configs.qmlls then
configs.qmlls = {
default_config = {
filetypes = { "qml" },
single_file_support = true,
root_dir = util.root_pattern(unpack(root_files)),
settings = {},
},
commands = {},
docs = {
description = "QML Language Server (qmlls)",
},
}
end
lspconfig.qmlls.setup({ cmd = { "qmlls6", "-E" }, on_attach = function(c, b) end })
return {
-- {
-- "neovim/nvim-lspconfig",
-- opts = {
-- setup = {
-- qmlls = function(_, opts_from_servers_table)
-- lspconfig.qmlls.setup({
-- cmd = { "qmlls6", "-E" },
-- on_attach = function(client, bufnr)
-- if opts_from_servers_table.on_attach then
-- opts_from_servers_table.on_attach(client, bufnr)
-- end
-- end,
-- capabilities = opts_from_servers_table.capabilities,
-- })
-- end,
-- },
-- },
-- },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment