Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't navigate to paths with a :lineNumber suffix? #6

Open
vith opened this issue Feb 18, 2019 · 9 comments
Open

Can't navigate to paths with a :lineNumber suffix? #6

vith opened this issue Feb 18, 2019 · 9 comments

Comments

@vith
Copy link

vith commented Feb 18, 2019

I'm trying to match the paths in this output:

goroutine profile: total 176
44 @ 0x62926b 0x629313 0x63b29c 0x63aed9 0x678f45 0xc05ad3 0x658bf1
#	0x63aed8	sync.runtime_Semacquire+0x38						/usr/lib/golang/src/runtime/sema.go:56
#	0x678f44	sync.(*WaitGroup).Wait+0xb4						/usr/lib/golang/src/sync/waitgroup.go:130

using a custom regex: (?<=(\s|^))\/[^\s]+

It looks like my regex is doing what I expect: https://regexr.com/48jnn

But I get the error Open file from path: Current cursor position is not valid, check the 'open-file-from-path.regExp' option to configure your RegExp match when using alt+d with the cursor inside one of those paths.

@Jack89ita
Copy link
Owner

Jack89ita commented Feb 22, 2019

Hi @vith! Thanks for the feedback.
The error you see means that the plugin cannot find the string in which it should use the regex to get the final file path; so i think we are a step behind searching for a file.
Are those strings in the editor when you try to run the command with alt+d?
Thank you!

@vith
Copy link
Author

vith commented Feb 22, 2019

They were in an editor buffer and my cursor was in the middle of one of the paths. I believe it was in an unsaved buffer but today I can't reproduce that error.

Now I get Open file from path: Warning, no matches were found. in a saved buffer, and nothing happens at all in an unsaved (untitled) buffer.

@Jack89ita
Copy link
Owner

Ok now you maybe see this error because of the :lineNumber suffix.
If you try to remove it and test the command again does it work?
Thanks!

@vith
Copy link
Author

vith commented Feb 22, 2019

Nope, same thing with the :130 suffix removed: Open file from path: Warning, no matches were found.

@Jack89ita
Copy link
Owner

Jack89ita commented Feb 25, 2019

Hello @vith, what is the value of the open-file-from-path.startingPath setting in your workspace? Remember that this setting is used to define the root of the project; are you trying to open a path outside of the root of your project?

@vith
Copy link
Author

vith commented Feb 26, 2019

It's /, which seems to be the default. But yes, /usr/lib/golang/src/runtime/sema.go:56 is an absolute path which is outside my ${workspaceRoot}. But absolute paths inside the ${workspaceRoot} didn't work either I believe. Are only relative paths supported?

@Jack89ita
Copy link
Owner

Hello @vith,
i just tried to open a file form this path: "include /views/includes/home-content.pug" and it's working for me. So can you try to set an absolute path pointing into the root of your project and see if it works?
Thanks!

@vith
Copy link
Author

vith commented Mar 1, 2019

With open-file-from-path.startingPath set to /home/vith/test/, pressing alt+d on /home/vith/test/b.txt does nothing.

Not sure if that's what you meant for me to try. I think we may have some confusion between us about what kind of absolute paths are the problem. I'm talking about absolute filesystem paths, not the path part of a url. / refers to the root of the filesystem (on unixes). I should have mentioned I'm trying to use this on Linux, maybe you're on Windows?

@vith
Copy link
Author

vith commented Mar 1, 2019

To clarify, /home/vith/test/ was also the ${workspaceRoot} in the above test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants