Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ This extension is forked/rewriten from [C/C++ Intellisense](https://marketplace.
* `gnuGlobal.gtagsExecutable`
* Specify the path to the gtags. Default is 'gtags'.

* `gnuGlobal.gtagsLimitCommand`
* Specify the command pipe into Global tag search result to limit the maximum line count.
* Default is: `head -300`, for Windows users may set to: `more` for CMD or `Select-Object -first 300` for PowerShell.

* `gnuGlobal.objDirPrefix`
* If objDirPrefix is set and objDirPrefix directory exists, gtags creates objDirPrefix/project_dir directory and makes tag files in it. Global will also try to search tag files in that directory.
* This option is useful if you don't wan't to create tag files in your project directory.
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@
"scope": "machine",
"description": "Specify the path to the gtags."
},
"gnuGlobal.gtagsLimitCommand": {
"type": [
"string"
],
"default": "head -300",
"scope": "resource",
"description": "Specify the command pipe into Global tag search result to limit the maximum line count."
},
"gnuGlobal.libraryPath": {
"type": [
"array"
Expand Down
2 changes: 2 additions & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export default class GlobalConfiguration {

readonly debugMode = new WindowScopeEnumConfig('gnuGlobal.debugMode', BoolOption, BoolDefault.Disabled);

readonly gtagsLimitCommand = new WindowScopeConfig('gnuGlobal.gtagsLimitCommand', 'head -300');

/* resource scope configurations */
readonly autoUpdate = new ResourceScopeEnumConfig('gnuGlobal.autoUpdate', BoolDefault, BoolDefault.Default);

Expand Down
7 changes: 5 additions & 2 deletions src/global/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,11 @@ export default class Global extends executableBase {

async provideWorkspaceSymbols(query: string)
: Promise<vscode.SymbolInformation[]> {
const word = query + '*';
let cmd: string[] = ['--encode-path', '" "', '-xa', word, '| head -300'];
const word = query.split('').join('.*') + '.*'
let cmd: string[] = ['--encode-path', '" "', '-xa', word];
if (this.configuration.gtagsLimitCommand.get().length) {
cmd.push('|' + this.configuration.gtagsLimitCommand.get())
}
let lines = await this.execute_async(cmd, vscode.workspace.rootPath, this.saved_env);

return mapNoneEmpty(lines, (line) => {
Expand Down