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

projectorganizer: Add popup panel for navigation #1341

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

techee
Copy link
Member

@techee techee commented Apr 26, 2024

This feature allows quick navigation do document/workspace symbols based on their names, open files, and line numbers.

The panel's code is mostly stolen from the LSP plugin which in turn stole it from the Colomban Wendling's Commander plugin.

This feature allows quick navigation do document/workspace symbols
based on their names, open files, and line numbers.

The panel's code is mostly stolen from the LSP plugin which in turn
stole it from the Colomban Wendling's Commander plugin.
Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, see inline comments.

Apart from that, I was kind of disappointed that the "goto file" only lists Geany open documents rather than the project's documents -- maybe you'd like to add that?
Also, I hoped to be able to go to a specific file's line, not only in the current file -- but that's probably less useful in practice.

projectorganizer/src/prjorg-goto-anywhere.c Show resolved Hide resolved
projectorganizer/src/prjorg-goto-anywhere.c Outdated Show resolved Hide resolved
projectorganizer/src/prjorg-goto-panel.c Show resolved Hide resolved
geany_icons[i].pixbuf = get_tag_icon(geany_icons[i].icon_name);
}

if (icon < _N_ICONS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (icon < _N_ICONS)
if (icon < G_N_ELEMENTS(geany_icons))

maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if geany/geany@1931fcc from geany/geany#3849 could be merged and used here. While the icons can be accessed this way, if someone reorganizes something in Geany, it will break. So better have some proper API for accessing these icons.

projectorganizer/src/prjorg-goto-panel.c Outdated Show resolved Hide resolved
projectorganizer/src/prjorg-goto-panel.c Outdated Show resolved Hide resolved
@techee
Copy link
Member Author

techee commented Apr 28, 2024

@b4n Thanks for having a look at it - I'll address the changes you suggested.

Apart from that, I was kind of disappointed that the "goto file" only lists Geany open documents rather than the project's documents -- maybe you'd like to add that?

Definitely makes sense for projectorganizer which knows what files belong to the project. So yes, I should add that. This isn't possible in the LSP plugin from which this feature was taken because the plugin itself doesn't know what files belong to the project (this is only known to the server).

Maybe I could also re-introduce the fuzzy search you use in the Commander plugin so one doesn't have to type the searched query exactly. In the LSP plugin it didn't make sense for the workspace symbols where the server did something like that already but e.g. for file names or file's symbols it could be useful (still we probably shouldn't use it for workspace symbols because there's way too many of them and filtering them could take too long because of this).

Also, I hoped to be able to go to a specific file's line, not only in the current file -- but that's probably less useful in practice.

Probably not hard to add something like filename.c:123, I'm just sure I'd be too lazy to type something like that :-). But maybe e.g. the right arrow could complete the value in the search entry to the selected value in the list so one could then just type :123.

techee added 6 commits May 6, 2024 23:28
Call normalization on the whole strings before splitting and also reduce
the number of displayed entries to 20 to speed up lookups of large
number of symbols.
The code sorts open files before other project files and distinguishes
these two by icon - _ICON_OTHER for open files, _ICON_NONE for other
project files.
@techee
Copy link
Member Author

techee commented May 7, 2024

Apart from that, I was kind of disappointed that the "goto file" only lists Geany open documents rather than the project's documents -- maybe you'd like to add that?

Done in the last commit - open files are sorted before project files and also non-open project files don't have any icon in front of them to distinguish them from the open files.

Also, I hoped to be able to go to a specific file's line, not only in the current file -- but that's probably less useful in practice.

Not done now, possibly in the future.

@techee techee requested a review from b4n May 7, 2024 16:30
@techee
Copy link
Member Author

techee commented Jun 30, 2024

I've updated this PR to use geany/geany#3916. What's still missing is updating the required Geany API once we bump it in Geany.

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

Successfully merging this pull request may close these issues.

None yet

2 participants