Skip to content

Lsp capabilities not working with obsidian.nvim #382

Description

@owod24

I am using obsidian.nvim for my note taking system and after setting up marksman, i tried to use the features such as hover documentation and goto definition but i cant get it to work
Here is my obsidian.nvim config
`
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter",
-- "neovim/nvim-lspconfig",
},

config = function()
	require("obsidian").setup({
		---@param url string
		follow_url_func = function(url)
			-- Open the URL in the default web browser.
			vim.fn.jobstart({ "open", url }) -- Mac OS
		end,

		ui = {
			enable = false,
			checkboxes = {
				["x"] = { char = "󰱒", hl_group = "ObsidianDone" },
			},
		},
		workspaces = {
			{
				name = "personal",
				path = "~/Desktop/Personal/Obsidian/Main/",
			},
		},

		templates = {
			folder = "05 - Resources/Templates",
			date_format = "%Y-%m-%d",
		},

		disable_frontmatter = true,
		notes_subdir = "+Inbox",
		new_notes_location = "notes_subdir",
		--NOTE: Create functions to select template on ObsidianNew command
		note_id_func = function(title)
			-- If a title is provided, use it as the filename with spaces
			return title or tostring(os.time())
		end,
		-- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp.
		completion = {
			-- Set to false to disable completion.
			nvim_cmp = true,
			-- Trigger completion at 2 chars.
			min_chars = 2,
		},

		picker = {
			name = "telescope.nvim",
		},
		mappings = {
			-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
			["gf"] = {
				action = function()
					return require("obsidian").util.gf_passthrough()
				end,
				opts = { noremap = false, expr = true, buffer = true },
			},
			-- Toggle check-boxes.
			["<leader>ch"] = {
				action = function()
					return require("obsidian").util.toggle_checkbox()
				end,
				opts = { buffer = true },
			},
			-- Smart action depending on context, either follow link or toggle checkbox.
			["<cr>"] = {
				action = function()
					return require("obsidian").util.smart_action()
				end,
				opts = { buffer = true, expr = true },
			},
		},
	})
	-- Key mapping to create a new note with a selected template
	vim.api.nvim_set_keymap("n", "<leader>on", ":ObsidianNew<CR>", { noremap = true, silent = true })
	vim.api.nvim_set_keymap("n", "<leader>ot", ":ObsidianTemplate<CR>", { noremap = true, silent = true })
	vim.api.nvim_set_keymap("n", "<leader>oT", ":ObsidianTags<CR>", { noremap = true, silent = true })
	vim.api.nvim_set_keymap("n", "<leader>or", ":ObsidianRename<CR>", { noremap = true, silent = true })
	vim.api.nvim_set_keymap("n", "<leader>os", ":ObsidianSearch<CR>", { noremap = true, silent = true })

	vim.api.nvim_set_keymap("n", "<CR>", ":lua follow_url_func<CR>", { noremap = true, silent = true })
end,

`

And here is my marksman config:

`
["marksman"] = function()
-- TODO: Lsp keymaps for marksman not working
lspconfig.marksman.setup({
root_dir = function()
return vim.fn.expand("~/Desktop/Personal/Obsidian/Main/")
end,
cmd = { "marksman", "server" }, -- Moved out of settings
settings = {
marksman = { -- Added marksman table
features = { -- Moved features inside marksman settings
definition = true,
references = true,
hover = true,
},
-- Add these to help with Obsidian paths
includes = {
"/*.md",
"
/*.markdown",
},
},
},
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "markdown", "markdown.mdx", ".md" }, -- Added explicit filetypes
})
end,

`

Im not sure what the issue is or if theyre compatible. I would like to know

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionGeneral question about functionality, integrations, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions