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

util.doc_is_open preforms case sensitive comparisent on windows #129

Open
Callmore opened this issue May 31, 2024 · 3 comments
Open

util.doc_is_open preforms case sensitive comparisent on windows #129

Callmore opened this issue May 31, 2024 · 3 comments

Comments

@Callmore
Copy link

OS: Windows 11
Lite XL version: 2.1.4

Managed to hack it to fix it locally, though the fix was to force the drive letter to uppercase.
When trying to check if the file was open to show diagnostics on it, the lua language server was returning the letter as lowercase, but the opened file in lite XL has an uppercase drive letter. This was causing the comparisent to fail, for seemingly no reason.
Think this is related to #114 as the diagnostics would appear before I hacked it when toggled, as they where shown whenever I turned them off and back on again.

@Guldoman
Copy link
Member

Does replacing

lite-xl-lsp/util.lua

Lines 16 to 29 in ed83454

function util.doc_is_open(abs_filename)
-- make path separator consistent
abs_filename = abs_filename:gsub("\\", "/")
for _, doc in ipairs(core.docs) do
---@cast doc core.doc
if doc.abs_filename then
local doc_path = doc.abs_filename:gsub("\\", "/")
if doc_path == abs_filename then
return true;
end
end
end
return false
end
with something like

function util.doc_is_open(abs_filename)
  -- make path separator consistent
  abs_filename = common.normalize_path(abs_filename)
  for _, doc in ipairs(core.docs) do
    ---@cast doc core.doc
    if doc.abs_filename == abs_filename then
      return true;
    end
  end
  return false
end

solve the issue?

@Callmore
Copy link
Author

Callmore commented Jun 1, 2024

It does solve it.

@Guldoman
Copy link
Member

Guldoman commented Jun 1, 2024

Should be fixed with 21faf00.

You can test it using lpm with lpm run --ephemeral https://github.com/lite-xl/lite-xl-lsp.git:21faf00bdcb59e5b81ae8b1018d262cbf84efc81 lsp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants