antonk52 / cssmodules-language-server

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

Duplicate Drive path #14

Closed gsihaj5 closed 7 months ago

gsihaj5 commented 1 year ago

after installing this LSP it loaded correctly, but the reference is wrong.

i have file -Login.tsx -Login.module.css

i use

import LoginStyle from './Login.module.css'

but when i go to definition the error is no such file or Directory, open 'D:\D:\Projects\myproject\src\Login.module.css'

notice the drive alias is double

the root directory is correct at my project D:\Projects\myproject

antonk52 commented 1 year ago

Thank you for taking the time to create an issue. This is definitely a bug in this project. I would be happy to debug this, though I don't have a windows machine.

I am happy to provide guidance if you or someone else wants to take a stab at it.

This seems like an issue with findImportPath which is used by DefinitionProvider to locate css file with imported styles. To debug it, you can build the server npm run build and point your editor at the built file ./lib/cli.js.

If you won't see the console logs in your server. You can write them to an external file and tail it. Something along these lines

const log = (...args) =>
  fs.writeSync(
    '/tmp/cssm-server-log',
    args
      .map(x => typeof x === 'object' ? JSON.stringify(x) : x)
      .join(', ') + '\n'
  )

Please let me know if you need more pointers.