Comments (5)
Cannot reproduce. Maybe it only happens in WSL?
from neovim.
I tried it on Mac and reproduced it. Did you wait a few seconds for the LSP to launch after opening empty.lua?
from neovim.
Oops, I misspelled .editorconfig
. It's strange that this bug only happens when there is a .editorconfig
file present.
from neovim.
Actually, it does not occur when there is a .editorconfig
file, but when I am under the directory existing root marker files (or directories) for LSP. It occurs when there is a .git
directory or editing root_marker
such as local root_markers = { 'minimal.lua' }
in minimal.lua
.
from neovim.
I think this is kinda expected. The behavior of expand('%')
depends on how the buffer was added.
When neovim receives diagnostics from the language server it calls bufadd
for the file uris/filenames
E.g. compare:
- Open nvim without file
:call bufadd("/absolute/path/to/file")
:e to/file
:echo expand("%")
With
- Open nvim without file
:call bufadd("relative/path")
:e relative/path
:echo expand("%")
Regarding .git
/.editorconfig
: .git
is a folder and .editorconfig
is a file so you get a different root_dir. Compare vim.fn.fnamemodify(".git/", ":p:h")
with vim.fn.fnamemodify(".editorconfig", ":p:h")
in a folder where both exists. I use something like this because of that difference:
function M.find_root(markers, path)
path = path or api.nvim_buf_get_name(0)
local match = vim.fs.find(markers, { path = path, upward = true })[1]
if match then
local stat = vim.loop.fs_stat(match)
if stat and stat.type == "directory" then
return vim.fn.fnamemodify(match, ':p:h:h')
end
return vim.fn.fnamemodify(match, ':p:h')
end
return nil
end
from neovim.
Related Issues (20)
- Inconsistent behavior around vim.api.nvim_tabpage_set_var and vim.api.nvim_tabpage_get_var HOT 2
- completeopt=popup crashing neovim HOT 4
- multibyte 'langmap' doesn't work for custom mapping HOT 3
- New regular expression atoms for WORD-boundaries HOT 1
- Explain that the root node is not displayed in InspectTree HOT 1
- Downloading 'nvim-linux64.tar.gz' by following wiki results corrupt file HOT 2
- using t_Cs to set undercurl works in vim but not neovim HOT 7
- Sidebar obscures content on online help docs (neovim.io website) HOT 1
- fswatch: Event queue overflow with pyright lsp in git repo HOT 9
- ext_cmdline/message for the TUI: tracking issue HOT 1
- `<C-Space>` as mapleader doesn't work and gives unexpected behavior HOT 4
- `treesitter/highlighter: Invalid '_subpriority': out of range` HOT 2
- ui_comp_raw_line: Assertion `attrs[i] >= 0' HOT 4
- [Windows] Nightly release triggers Windows Defender virus detection HOT 1
- Treesitter conceal broken HOT 4
- Segfault (msgpack) HOT 37
- Allow opening man pages in the current window HOT 3
- Installation failed on Fedora 39 HOT 4
- return to previous window when quitting table of contents HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neovim.