promote lib manage
This commit is contained in:
parent
52349329df
commit
6ef036fa78
@ -1,5 +1,6 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import { hdlFile } from '../hdlFs';
|
||||||
|
|
||||||
import { Arch, PrjInfo, RawPrjInfo, resolve, toSlash } from './prjInfo';
|
import { Arch, PrjInfo, RawPrjInfo, resolve, toSlash } from './prjInfo';
|
||||||
|
|
||||||
@ -141,6 +142,22 @@ class OpeParam {
|
|||||||
public resolvePathExtension(relPath: RelPath): AbsPath {
|
public resolvePathExtension(relPath: RelPath): AbsPath {
|
||||||
return resolve(this._extensionPath, relPath);
|
return resolve(this._extensionPath, relPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get User's property.json
|
||||||
|
*/
|
||||||
|
public getUserPrjInfo() {
|
||||||
|
const propertyJsonPath = this.propertyJsonPath;
|
||||||
|
const userPrjInfo = new PrjInfo();
|
||||||
|
if (fs.existsSync(propertyJsonPath)) {
|
||||||
|
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath);
|
||||||
|
userPrjInfo.merge(rawPrjInfo);
|
||||||
|
} else {
|
||||||
|
// use default config instead
|
||||||
|
const rawPrjInfo = hdlFile.readJSON(this.propertyInitPath);
|
||||||
|
userPrjInfo.merge(rawPrjInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const opeParam: OpeParam = new OpeParam();
|
const opeParam: OpeParam = new OpeParam();
|
||||||
|
@ -145,6 +145,8 @@ class LibPick {
|
|||||||
|
|
||||||
if (selectedPath && hdlPath.exist(selectedPath)) {
|
if (selectedPath && hdlPath.exist(selectedPath)) {
|
||||||
const ppyPath = hdlPath.join(opeParam.workspacePath, '.vscode', 'property.json');
|
const ppyPath = hdlPath.join(opeParam.workspacePath, '.vscode', 'property.json');
|
||||||
|
|
||||||
|
// 抽象这块
|
||||||
let prjInfo = null;
|
let prjInfo = null;
|
||||||
// 如果存在,则读取用户的配置文件,否则使用默认的
|
// 如果存在,则读取用户的配置文件,否则使用默认的
|
||||||
if (!hdlPath.exist(ppyPath)) {
|
if (!hdlPath.exist(ppyPath)) {
|
||||||
@ -152,11 +154,10 @@ class LibPick {
|
|||||||
} else {
|
} else {
|
||||||
prjInfo = hdlFile.readJSON(ppyPath);
|
prjInfo = hdlFile.readJSON(ppyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedPath.includes(this.commonQuickPickItem.path!)) {
|
if (selectedPath.includes(this.commonQuickPickItem.path!)) {
|
||||||
// this is a module import from common, use relative path
|
// this is a module import from common, use relative path
|
||||||
const relPath = selectedPath.replace(this.commonQuickPickItem.path + '/', '');
|
const relPath = selectedPath.replace(this.commonQuickPickItem.path + '/', '');
|
||||||
|
|
||||||
appendLibraryCommonPath(relPath, prjInfo);
|
appendLibraryCommonPath(relPath, prjInfo);
|
||||||
} else {
|
} else {
|
||||||
// this is a module import from custom, use absolute path
|
// this is a module import from custom, use absolute path
|
||||||
|
@ -86,7 +86,6 @@ class PrjManage {
|
|||||||
public initialise() {
|
public initialise() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const prjManage = new PrjManage();
|
const prjManage = new PrjManage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user