lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Trailing slash for rootUri will duplicate folder name

Open nigjo opened this issue 1 year ago • 1 comments

How are you using the lua-language-server?

Other

Which OS are you using?

Windows

What is the issue affecting?

Other

Expected Behaviour

No folder name duplication

Actual Behaviour

If a LS client send a rootUri with a trailing slash the last folder name is duplicated to get the "workspace path".

I already filed a bug for Apache Netbeans (https://github.com/apache/netbeans/issues/7166), but why is LuaLS duplicating the folder's name?

Reproduction steps

see description in https://github.com/apache/netbeans/issues/7166

Additional Notes

No response

Log File

No response

nigjo avatar Mar 16 '24 14:03 nigjo

As a workaround for us we removed any trailing slash from the rootUri in provider.lua

    m.register 'initialize' {
        function(params)
            if params.rootUri and params.rootUri:sub(#params.rootUri) == '/' then
                params.rootUri = params.rootUri:sub(1, -2)
            end
            client.init(params)

but this (I think) just removes the symptom not the cause

nigjo avatar Mar 21 '24 08:03 nigjo