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

[Feature Request] Opening a file within Notepad++ and jump to line #14579

Closed
cbielow opened this issue Jan 11, 2024 · 6 comments
Closed

[Feature Request] Opening a file within Notepad++ and jump to line #14579

cbielow opened this issue Jan 11, 2024 · 6 comments

Comments

@cbielow
Copy link

cbielow commented Jan 11, 2024

Description of the Issue

Log files (a doxygen error log in my case, but also compiler errors etc) usually contain lines like:

C:/dev/IdentificationData.h:617: warning: Found unknown command '@TODO'

If I have this logfile open in Notepad++ already, I now want to open the IdentificationData.h and immediately jump to line 617 -- all within Notepad++.
Notepad++ can already do this when run from the command line, although with a different syntax.

Ideally, pasting C:/dev/IdentificationData.h:617 into the Open-File menu dialog opens the file and jumps to line 617.
This should be save on Windows, since colon (:) is not a valid character allowed in filenames (its a different story with many Linux filesystems).

Steps to Reproduce the Issue

  1. Press Ctrl-o to open the OpenFile Menu
  2. Enter a filename with :XX some line number as suffix

Expected Behavior

Opens the file and jumps to line XX

Actual Behavior

Error: Filename is not valid

I would also volunteer to implement this, but first, it would be good to know if this would have a chance to get merged.

@alankilborn
Copy link
Contributor

if this would have a chance to get merged.

I'd guess "no" with the reasoning being today it is that syntax, tomorrow someone wants something slightly different, the next day...

The common way to handle such a problem is a batch/cmd/powershell script as an intermediary, taking in the non-Notepad++ syntax and converting to Notepad++ syntax.

@cbielow
Copy link
Author

cbielow commented Jan 11, 2024

I see the point, however I would argue that this syntax has been around forever (as far as g++3.x, probably beyond).

The common way to handle such a problem is a batch/cmd/powershell script as an intermediary, taking in the non-Notepad++ syntax and converting to Notepad++ syntax.

Is there a way to open a file from within Notepad++ that I'm not aware of?

@alankilborn
Copy link
Contributor

alankilborn commented Jan 11, 2024

Ach...okay, scratch my comment about batch, et al as that was a bit off-base for your original discussion. Sorry for misreading. Let me try to address your concern again.


Is there a way to open a file from within Notepad++ that I'm not aware of?

You can put the caret in the text of the filename and choose Edit > On Selection > Open File
OR (easier) you can right click the text of the filename and choose Open File from the context menu that pops up.

But, neither of those recognize any go-to-line-number syntax.

What you could do is add some scripting via a scripting plugin. If you'd entertain installing the PythonScript plugin, I'll volunteer to write you a little demo script that would do what you want.

@cbielow
Copy link
Author

cbielow commented Jan 12, 2024

You can put the caret in the text of the filename and choose Edit > On Selection > Open File OR (easier) you can right click the text of the filename and choose Open File from the context menu that pops up.

Good to know! That already saves a bit of selection overhead.

But, neither of those recognize any go-to-line-number syntax.

What you could do is add some scripting via a scripting plugin. If you'd entertain installing the PythonScript plugin, I'll volunteer to write you a little demo script that would do what you want.

Thanks a lot ! ;)
I tried installing the plugin, but it requires admin rights, which IT gave me, but only for 'unavoidable' use cases. And I guess this scenario is not included.
Thanks for your input and ideas!

Will close the issue for now.

@cbielow cbielow closed this as completed Jan 12, 2024
@alankilborn
Copy link
Contributor

Ideally, pasting C:/dev/IdentificationData.h:617 into the Open-File menu dialog opens the file and jumps to line 617.

Notepad++ uses Windows itself for the File > Open dialog, i.e., need to open a file, turn it over to Windows, Windows responds with a file path. There's not an easy method to insert "non-standard" processing (e.g., handling a colon plus line number on the end) into that.

@alankilborn
Copy link
Contributor

I'll volunteer to write you a little demo script that would do what you want.

The script is HERE as part of a better-than-Notepad++ "open file at caret" command replacement, even though you said:

I tried installing the plugin, but it requires admin rights, which IT gave me, but only for 'unavoidable' use cases. And I guess this scenario is not included.

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