Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with cwd root-dir detection #88

Open
clobrano opened this issue May 17, 2024 · 11 comments
Open

Problems with cwd root-dir detection #88

clobrano opened this issue May 17, 2024 · 11 comments
Labels
v0 bug Consideration that behavior is incorrect (in code or docs) v0

Comments

@clobrano
Copy link

clobrano commented May 17, 2024

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.

@Feel-ix-343
Copy link
Owner

Hey!

Could you share the result of lspinfo?

I think there is an issue with root_dir possibly

@clobrano
Copy link
Author

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 

@Feel-ix-343
Copy link
Owner

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?

@clobrano
Copy link
Author

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

@Feel-ix-343
Copy link
Owner

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

@clobrano
Copy link
Author

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',
    },
  },

@Feel-ix-343
Copy link
Owner

Ok thanks Ill investigate

@Feel-ix-343 Feel-ix-343 added this to the Refined Markdown Oxide milestone May 17, 2024
@Feel-ix-343 Feel-ix-343 changed the title Unresolved reference for any file that is not open in its own buffer Poor default root_dir setup May 17, 2024
@clobrano
Copy link
Author

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

@Feel-ix-343
Copy link
Owner

Awesome!

@clobrano clobrano changed the title Poor default root_dir setup Problems with default root_dir setup Jun 5, 2024
@Feel-ix-343
Copy link
Owner

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 Feel-ix-343 added the v0 bug Consideration that behavior is incorrect (in code or docs) v0 label Jul 12, 2024
@Feel-ix-343 Feel-ix-343 removed this from the Refined Markdown Oxide milestone Aug 5, 2024
@Feel-ix-343 Feel-ix-343 changed the title Problems with default root_dir setup Problems with cwd root-dir detection Aug 10, 2024
@Feel-ix-343
Copy link
Owner

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

@Feel-ix-343 Feel-ix-343 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2024
@Feel-ix-343 Feel-ix-343 reopened this Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v0 bug Consideration that behavior is incorrect (in code or docs) v0
Projects
Status: Closed
Development

No branches or pull requests

2 participants