Skip to content

more Windows path fix - #77

Open
Andriamanitra wants to merge 12 commits into
Andriamanitra:windows-path-fixfrom
bjornasm:windows-path-fix-debug
Open

more Windows path fix#77
Andriamanitra wants to merge 12 commits into
Andriamanitra:windows-path-fixfrom
bjornasm:windows-path-fix-debug

Conversation

@Andriamanitra

Copy link
Copy Markdown
Owner

No description provided.

@Andriamanitra Andriamanitra added the os:windows This issue only affects users using Microsoft's Windows operating system label Apr 13, 2026
@Andriamanitra Andriamanitra added this to the v1.0 milestone Apr 13, 2026

@Andriamanitra Andriamanitra left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this check for Windows, otherwise the gsubs can mess up Linux paths (both /C:/whatever and /C:\\what\ever/file are valid paths that we should not mess with on Linux).

if package.config:sub(1,1) == "\\" then
    -- do windows-specific stuff
else
    -- do the usual stuff
end

@bjornasm

Comment thread main.lua Outdated
Co-authored-by: Mikko <Andriamanitra@users.noreply.github.com>
@bjornasm

bjornasm commented Apr 21, 2026

Copy link
Copy Markdown
if package.config:sub(1,1) == "\\" then

Good point - I think the reason I changed was when testing - there was no package.config set. I this assumed set for everyone that uses the plugin?

Edit I get this error when trying lsp start with if package.config:sub(1,1) == "\\" - it might be something local to me.

Lua API error: main:1645: attempt to index a non-table object(nil) with key 'sub'
stack traceback:
        main:1645: in function 'fileUriFromAbsPath'
        main:288: in function 'initialize'
        main:198: in function 'func'
        main:125: in main chunk
        [G]: ?

However, for me the following alternative works

local runtime = import("runtime")

(...) 
if runtime.GOOS == "windows" then

But this might be just something wrong on my end.

@Andriamanitra

Copy link
Copy Markdown
Owner Author
if package.config:sub(1,1) == "\\" then

Good point - I think the reason I changed was when testing - there was no package.config set. I this assumed set for everyone that uses the plugin?

Edit I get this error when trying lsp start with if package.config:sub(1,1) == "\\" - it might be something local to me.

Lua API error: main:1645: attempt to index a non-table object(nil) with key 'sub'
stack traceback:
        main:1645: in function 'fileUriFromAbsPath'
        main:288: in function 'initialize'
        main:198: in function 'func'
        main:125: in main chunk
        [G]: ?

However, for me the following alternative works

local runtime = import("runtime")

(...) 
if runtime.GOOS == "windows" then

But this might be just something wrong on my end.

Weird, I'm not sure why package.config would be nil on Windows. Your suggested alternative seems fine, let's use that instead.

@bjornasm

bjornasm commented May 6, 2026

Copy link
Copy Markdown

Sorry for the delay @Andriamanitra - I updated the PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

os:windows This issue only affects users using Microsoft's Windows operating system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants