Skip to content

Commit

Permalink
OVSX
Browse files Browse the repository at this point in the history
+ OVSX support (dev-dependencies: npx + ovsx; extended cd-worfklow with OVSX-env-secret)
+ TOML-Generator refactored to string instead of writestream
+ add docs and .github to ".vscodeignore"
  • Loading branch information
jakobjung10 committed Jan 29, 2024
1 parent 264593f commit d165b1a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ jobs:
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
4 changes: 3 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
.gitignore
.gitmodules
.gitmodules
.github
docs
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"esbuild-minify": "npm run esbuild-base -- --minify",
"vscode:prepublish": "npm run esbuild-base -- --sourcemap",
"deploy": "vsce publish"
"deploy": "vsce publish && npx ovsx publish"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
Expand Down Expand Up @@ -749,6 +749,8 @@
"glob": "^7.1.6",
"js-yaml": "^3.13.1",
"mocha": "^7.1.2",
"npx": "^10.2.2",
"ovsx": "^0.8.3",
"shx": "^0.3.3",
"typescript": "4.5.5",
"vscode-languageclient": "7.0.0-next.6"
Expand Down
13 changes: 8 additions & 5 deletions src/features/hdl_tools/vhdl_package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ export class VhdlEntity {
mPath: string = "";
}

export const cVhdlFileTypes : string[] = [
".vhd",
".vhdl",
".vho"
];
export enum eVhdlDesignFileType {
vhd = ".vhd",
vhdl = ".vhdl",
}

export enum eVhdlJunkFileType {
vho = ".vho",
}
6 changes: 4 additions & 2 deletions src/features/utils/hdl/general/hdl_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs';

//specific imports
import { SimpleVhdlParser } from '../parser/simple_vhdl_parser';
import { cVhdlFileTypes } from '../../../hdl_tools/vhdl_package';
import { eVhdlDesignFileType } from '../../../hdl_tools/vhdl_package';

export class HDLUtils {

Expand Down Expand Up @@ -97,7 +97,9 @@ export class HDLUtils {
{
let isVhdl : boolean = false;

cVhdlFileTypes.forEach(
const vhdlFileTypes = Object.values(eVhdlDesignFileType) as string[];

vhdlFileTypes.forEach(
(fileType) => {
if(filePath.endsWith(fileType)) {isVhdl = true;}
}
Expand Down
36 changes: 17 additions & 19 deletions src/features/utils/toml/toml_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,53 +28,51 @@ export class TomlUtils {

public static Generate_VHDL_LS(sourceManager : SourceManager, workSpacePath : string, isRelativePaths: boolean = true) : void
{
const FileName : string = path.join(workSpacePath, vhdl_ls.VHDL_LS_FILE);

let wstream = fs.createWriteStream(FileName, { flags: 'w' });
const tomlPath : string = path.join(workSpacePath, vhdl_ls.VHDL_LS_FILE);
let tomlString : string = "";

//print libraries-header
wstream.write(TOML_Open_Char + TOML_Libraries + TOML_Closing_Char + TOML_New_Line);
tomlString += "[" + TOML_Libraries + "]" + "\n";
//Iterate over all libraries
for(const [lib,lib_contents] of sourceManager.GetProjectFiles().entries())
{
//print file-header
wstream.write(TOML_New_Line + lib + TOML_Point + TOML_Files_Spec + TOML_Open_Char + TOML_New_Line);
tomlString += "\n" + lib + "." + TOML_Files_Spec + "[" + "\n";
//Iterate over all files in a library
for(let file of lib_contents.files)
{
wstream.write(TOML_Quote);
tomlString += "\"";

if(isRelativePaths)
{
//relative path
wstream.write(path.relative(workSpacePath,file).replace(/\\/g, '\\\\'));
tomlString += path.relative(workSpacePath,file).replace(/\\/g, '\\\\');
}
else
{
//absolute path
wstream.write(file.replace(/\\/g, '\\\\'));
tomlString += file.replace(/\\/g, '\\\\');
}

wstream.write(TOML_Quote);
wstream.write(TOML_Comma);
wstream.write(TOML_New_Line);
tomlString += "\"";
tomlString += ",";
tomlString += "\n";

}
wstream.write(TOML_Closing_Char);
wstream.write(TOML_New_Line);
tomlString += "]";
tomlString += "\n";

if (lib_contents.is_third_party)
{
wstream.write(lib + TOML_Third_Party);
wstream.write(TOML_New_Line);
tomlString += lib + TOML_Third_Party;
tomlString += "\n";
}

}

//close writestream
wstream.end();
fs.writeFileSync(tomlPath, tomlString);
}

public static Parse_VHDL_LS(filePath : string) : VhdlProjectFiles
Expand Down

0 comments on commit d165b1a

Please sign in to comment.