Skip to content

Commit 61df458

Browse files
committed
Add cscopeOverwritePath setting
The ability to overwrite the path to the cscope executable is needed to support custom installations. - Added a new setting, `edk2code.cscopeOverwritePath`, to allow users to specify a custom path to the cscope executable. - Modified the `Cscope` class constructor to use the value of `cscopeOverwritePath` if provided, otherwise it falls back to the default behavior.
1 parent 74cbfec commit 61df458

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "edk2code",
33
"displayName": "Edk2code",
44
"description": "EDK2 code support",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"icon": "assets/icon.png",
77
"publisher": "intel-corporation",
88
"homepage": "https://github.com/intel/Edk2Code/wiki",
@@ -137,9 +137,15 @@
137137
"edk2code.useEdkCallHierarchy": {
138138
"order": 2,
139139
"type": "boolean",
140-
"markdownDescription": "Set this to use EDK2 call hiearchy instead of vscode native one. (Need reload of vscode)",
140+
"markdownDescription": "Set this to use EDK2 call hiearchy (cscope) instead of vscode native one. `(reload of vscode after setup)`",
141141
"default": true
142142
},
143+
"edk2code.cscopeOverwritePath": {
144+
"order": 2,
145+
"type": "string",
146+
"markdownDescription": "Overwrites the calls to cscope executable path. `(reload of vscode after setup)`",
147+
"default": ""
148+
},
143149
"edk2code.extraIgnorePatterns": {
144150
"order": 2,
145151
"type": "array",
@@ -153,12 +159,6 @@
153159
"items": {
154160
"type": "string"
155161
}
156-
},
157-
"edk2code.generateGuidXref": {
158-
"order": 2,
159-
"type": "boolean",
160-
"markdownDescription": "Generate `Guid.csv` file based on Guid.xref files on workspace. File location: `${workspaceFolder}//.Edk2Code`",
161-
"default": true
162162
}
163163
}
164164
}

src/configuration.ts

+4
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ export class ConfigAgent {
250250
return <string[]>this.get("extraIgnorePatterns");
251251
}
252252

253+
getCscopeOverwritePath() {
254+
return (<string>this.get("cscopeOverwritePath")).trim();
255+
}
256+
253257
getIsGenGuidXrefFile() {
254258
return <boolean>this.get("generateGuidXref");
255259
}

src/cscope.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs';
22
import path = require('path');
33
import * as vscode from 'vscode';
4-
import { gCscope, gDebugLog, gEdkWorkspaces } from './extension';
4+
import { gConfigAgent, gCscope, gDebugLog, gEdkWorkspaces } from './extension';
55
import { exec, execWindow, getEdkCodeFolderFilePath, getEdkCodeFolderPath, getStaticPath, normalizePath, readLines, toPosix } from './utils';
66
import { execSync } from 'child_process';
77
import * as edkStatusBar from './statusBar';
@@ -68,15 +68,21 @@ export class Cscope {
6868
cscopeInstalled = false;
6969

7070
public constructor() {
71+
let cscopeOverwritePath = gConfigAgent.getCscopeOverwritePath();
7172

72-
if (process.platform === 'win32'){
73-
this.cscopePath = getStaticPath("cscope.exe");
73+
if(cscopeOverwritePath === ""){
74+
if (process.platform === 'win32'){
75+
this.cscopePath = getStaticPath("cscope.exe");
76+
}else{
77+
this.cscopePath = "cscope";
78+
}
7479
}else{
75-
this.cscopePath = "cscope";
80+
this.cscopePath = cscopeOverwritePath;
7681
}
7782

83+
7884
var command = `${this.cscopePath} -V`;
79-
85+
8086
try {
8187
let result = execSync(command);
8288
gDebugLog.info(result.toString());

0 commit comments

Comments
 (0)