antonk52 / cssmodules-language-server

autocompletion and go-to-defintion for cssmodules
MIT License
54 stars 8 forks source link

fix duplicate drive path in windows #18

Closed Pineappletooth closed 7 months ago

Pineappletooth commented 7 months ago

DocumentUri in windows comes in the format file:///C:/path/folder/example.js, when it's passed to getCurrentDirFromUri, the function returns /C:/path/folder/ which after being passed to path.resolve() provokes the duplicated drive bug.

This PR replaces the manual convertion of uri to path with the nodeJS function url.fileURLToPath documented here which has all filesystem differences covered.

Fixes #14