markdown-oxide icon indicating copy to clipboard operation
markdown-oxide copied to clipboard

Problems with cwd root-dir detection

Open clobrano opened this issue 1 year ago • 10 comments

I assume this might be some error in my configuration, but I see that any file that isn't already opened returns an "Unresolved reference" error. Even if the count of the references is working fine.

I created a test vault with this structure

tree
.
├── journal
│   ├── 2024-05-16.md
│   └── 2024-05-17.md
├── resources
│   └── some-data.md
└── tasks
    └── projectA.md

The current directory is the root of the vault (so above journal, resources and tasks) and only some-data is correctly referenced.

image

It seems to work better for files under the same folder though. I moved into journal and restarted the server and this made 2024-05-16 file correctly referenced.

clobrano avatar May 17 '24 13:05 clobrano

Hey!

Could you share the result of lspinfo?

I think there is an issue with root_dir possibly

Feel-ix-343 avatar May 17 '24 13:05 Feel-ix-343

You might be right. That running in single file mode is suspect :)

Client: markdown_oxide (id: 3, bufnr: [5, 53])                                                                                                                                                                     
~                        filetypes:       markdown                                                                                                                                                                                         
~                        autostart:       true                                                                                                                                                                                             
~                        root directory:  Running in single file mode.                                                                                                                                                                     
~                        cmd:             /home/clobrano/.local/share/nvim/mason/bin/markdown-oxide 

clobrano avatar May 17 '24 14:05 clobrano

Definitely.

In single file mode, root directory is the directory of the first opened file.

However, single file mode is unexpected on neovim; could you post your lspconfig for this?

Feel-ix-343 avatar May 17 '24 14:05 Feel-ix-343

Does it need a .obsidian file to detect the root folder? :)

clobrano avatar May 17 '24 14:05 clobrano

That is one way; there is also .git, .moxide.toml and if not those, the cwd of neovim

Feel-ix-343 avatar May 17 '24 14:05 Feel-ix-343

It seems that the cwd option is not working well (at least in this configuration). I do use it with code, so it works with .git and as soon as I added .obsidian it worked in the test vault too.

my lsp config is a bit scattered through my files, not sure this is all

{ -- LSP Configuration & Plugins
    'neovim/nvim-lspconfig',
    dependencies = {
      -- Automatically install LSPs to stdpath for neovim
      { 'williamboman/mason.nvim', config = true },
      'williamboman/mason-lspconfig.nvim',

`require('fidget').setup({})`
      { 'j-hui/fidget.nvim',       tag = 'legacy', opts = {} },

      'folke/neodev.nvim',
    },
  },

clobrano avatar May 17 '24 14:05 clobrano

Ok thanks Ill investigate

Feel-ix-343 avatar May 17 '24 16:05 Feel-ix-343

thank you! I was using [another markdown lsp] before, but this one is just awesome

clobrano avatar May 17 '24 19:05 clobrano

Awesome!

Feel-ix-343 avatar May 18 '24 03:05 Feel-ix-343

Hey sorry for the delay -- was on vacation.

I think I will look more into this when I am making the #95

Feel-ix-343 avatar Jul 02 '24 15:07 Feel-ix-343

in v1 I will be rewriting all of this code, so I will fix this then.

Feel-ix-343 avatar Aug 20 '24 13:08 Feel-ix-343