[Plugin Update] - NppGTags v4.0.0
-
@pnedev said:
When creating its database, GTags recursively parses all files and folders under a given path and you cannot include other root path to the same database.
But I don’t need to include multiple root path into the same database. All I need is to search from 1 specified database no matter which file is currently open under Npp. Is this also not possible because of the GTags design?
How about this, in NppGTags, before searching any key words, just switch the current PATH value to the pre-specified path which containing the database, then launch the real GTags and passing the keyword+PATH setting values?
-
To search from one specified database you need to have a database :)
To create the database, GTags parses recursively one project root path. All files under that path are indexed.
If you want to search another file that is not in a sub-path of the database root you need to somehow add it to the database as it is not indexed. This is something you cannot do.
So your files outside the database root are not indexed, in other words - they are not in the database and thus - you cannot use that database to search them. -
@pnedev said:
To search from one specified database you need to have a database :)
…It is really nice of you but this is not my point. Or maybe I explained myself too badly. :-)
Let me try again:
I have created a database. All my source files are under 1 root folder, and are indexed in this database. I only want to search these source files in the database. I don’t want to search any other file outside the root folder, i.e. non-nppgtags-indexed files.Normally I open lots of source files in Npp, and using NppGTags when programming. This works very well.
But sometimes I create a new txt file (i.e. “new 1” as displayed in Npp) to write some quick notes, e.g. funcX() is buggy, to be patched. Then I want to quickly switch to funcX().
funcX() has been indexed in the database of course.Now the problem is, NppGTags locates the database depending on the currently active file in Npp. Because the currently opened file is the new text “new 1”, it doesn’t belong to the database. So NppGTags cannot perform the search.
Then I need to stop, and first mouse clicking a source file, then run the NppGTags. This works but slow (click required) and interrupt the thinking.
This case also happens when I first open Npp, and if no source file opened, there will be only a “new 1”. Now the search also doesn’t work.So what I want is NppGTags can always search from 1 specified database (which is created before ofc), regardless which file I am currently editing in the Npp. If I call a NppGTags command, give a keyword, it can always search the database without saying “GTags database not found”.
-
I understand you now :)
Thanks for explaining.
Yes, you are right - this is possible.
I’ll think about how such functionality can be added (and made easily usable) without messing things up. -
-
-
@pnedev
Just saw this today. Somehow my Npp doesn’t show there is a new NppGTags plugin available. Strange. So I didn’t notice.Just tried out the v4.2.1. The default database works perfectly. This is what I like. Thanks pnedev, you are great!
Now if I am still allowed to provide more user feedback :-) Please note that you are free to disagree.
Imho it would be nicer to make a separate option for “create database” and “recreate/refresh database”.Allow me to explain the situation. For my root folder of source files, I have created database. Regularly I need to update source files from SVN, meaning the files are changed out of NppGTags awareness. To refresh the database, I sort of use (or abuse) the “create database” option with a shortcut.
Now with the default database enabled, when I am editing a random txt file e.g. “new 1”, I want to refresh the default database then do a search. But if I hit the “create database” under “new 1”, the choose-folder window will pop up. As the NppGTags doesn’t know if I want to make a new database, or to refresh the default database.My suggest is to have 1 create database, and 1 update database (or can be called refresh/recreate database as the name you like)
- when doing “create database” always pop up the folder selection window to create a new DB, even when the current active source files is already belong to some existing database.
- when doing “update database”, first recreate the default DB if which is enabled; if not, recreate the current DB if the can be found; and if still not, give an error or do “create database”
So my user experience offered for discussion.
-
Hi @olivercamel ,
I understand. But I would prefer not to add another command to the plugin menu unless it really adds functionality (or greatly improves usability). Otherwise things get a bit messy.
Create / re-create / refresh database is actually one and the same action behind the scenes.
If you would like to refresh a DB from a file it contains you need to trigger “Create database” and give “Yes” to the database re-create pop-up question.
If you would like to refresh the default DB then you have 2 options:- From a file that is not indexed (let’s say “New 1”) make a random search - default DB will be searched. Open a random file from it (returned from the random “New 1” search) and then trigger “Create database” command. That’s some kind of work-around, I know.
- Simply open NppGTags Settings window and click “Update DB” for the default DB section. When it starts updating (re-creating) you can close the settings window - it will not be needed anymore - just hit “ESC” key or click Settings window “Cancel” button.
Thanks for the suggestion.
BR
-
Hi @pnedev
I use both your options, starting with (2), and now prefer (1) better.
My point is I’d try to avoid mouse-clicking during programming (which is also the reason I come to give feedback, and previous feedbacks). While typing if I have to switch to mouse, it always interrupt my mind of thinking. So in my notepad++ each NppGTags command I’ve assigned a shortcut to it.The option (2) is that there is no key possible for “Update DB”, so I open setting menu with a shortcut but then always have to click the button. The option (1) I can do with keyboard, but then I need to remember if I am editing in the right file or not.
Having used to (quickly) the global DB, I can use commands e.g. Find Definition in any file, so I’d naturally think Create DB command would also work regardless which file I am in. But this is not the case.
Actually all my point was that if I can trigger a Update global DB with 1 shortcut someway.Anyhow I hope my feedback and reasoning is clearly explained. Thanks for your nicely reply. I will stick to option (1) now.
-
Hi @olivercamel ,
You are right about the need to use the mouse, I haven’t thought about that.
I’ll consider your suggestion and might implement it (or something similar that fixes the inconvenience) some time in the future.
Thanks for explaining.BR