Skip to content

Go to defintion does not work with paths with leading slash #66

@jpogran

Description

@jpogran

Part of go to definition feature is navigating to the source file where the function is defined if it's not in the current file. On platforms with paths that have leading slashes, this does not work.

On ubuntu 18.04, vscode 1.28, and pdk 1.7.1 type a simple file declaration and watch the log:

D, [2018-10-24T16:11:25.404160 #34999] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":9,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///home/james/Documents/foo.pp"},"position":{"line":0,"character":2}}}
---
D, [2018-10-24T16:11:25.418013 #34999] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":9,"result":[{"uri":"file:////opt/puppetlabs/pdk/share/cache/ruby/2.4.0/gems/puppet-6.0.2/lib/puppet/type/file.rb","range":{"start":{"line":14,"character":0},"end":{"line":14,"character":1024}}}]}
---
D, [2018-10-24T16:11:25.554092 #34999] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":10,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/james/Documents/foo.pp"},"position":{"line":0,"character":5}}}
---

Note the file uri differences between the definition request and the hover request. It's not a pathing issue in detecting pdk folders because the file is present at that location.

The lines below are where we are building the file uris:

https://github.com/lingua-pupuli/puppet-editor-services/blob/113a7e292db42b07e208233ca4c1b932fa312b7b/lib/puppet-languageserver/manifest/definition_provider.rb#L73

https://github.com/lingua-pupuli/puppet-editor-services/blob/113a7e292db42b07e208233ca4c1b932fa312b7b/lib/puppet-languageserver/manifest/definition_provider.rb#L88

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions