Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #363

Merged
merged 8 commits into from
Dec 20, 2022
Merged
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
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ renovate.json
**/*.map
**/*.ts
language_examples/**
.hdl_checker/**
**/.hdl_checker/**
**/svls.log
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
- \[Caution\] Language Server config names has changed!
- Users may have to reset all the configs related to Language Server feature.
- verible-verilog-ls support is temporary dropped because it returns error when stopping.
- Deprecated `verilog.logging.enabled` option.
- Logs are always outputted to the **Verilog** OutputChannel of VS Code in the **Output** pane.

## [1.5.13] - 2022-12-12

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,13 @@ Use the following settings to configure the extension to your needs

Path to your installation of Ctags if it isn't already present in your `PATH` environment variable.

- `verilog.logging.enabled` (Default: `false` )

Enable logging for this extension. Open the **Output** pane in VS Code and choose _Verilog_ in the drop-down menu to view the log.

- `verilog.languageServer.svls.enabled` (Default: `false`)

\[Experimental\] Enable svls Language Server for SystemVerilog.

- `verilog.languageServer.svls.path` (Default: `svls`)

\[Experimental\] A path to the Svls Language Server binary.
\[Experimental\] A path to the svls Language Server binary.

- `verilog.languageServer.veridian.enabled` (Default: `false`)

Expand Down Expand Up @@ -181,6 +177,11 @@ If you have tested the linters in new platforms or have issues with them, feel f

## [Guidelines for Contributing](./CONTRIBUTING.md)

## Logging

Logs are outputted to OutputChannel in th VS Code.
Open the **Output** pane in VS Code and choose _Verilog_ in the drop-down menu to view the log.

## Helpful links

- [Verilog in VSCode With Linting (Using Modelsim) - YouTube](https://www.youtube.com/watch?v=-DTGf3Z6v_o)
Expand Down
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,6 @@
"default": "none",
"description": "A path to the installation of Universal Ctags."
},
"verilog.logging.enabled": {
"scope": "window",
"type": "boolean",
"default": false,
"description": "Enable logging for this extension."
},
"verilog.languageServer.svls.enabled": {
"scope": "window",
"type": "boolean",
Expand Down Expand Up @@ -386,4 +380,4 @@
"publisherDisplayName": "mshr-h",
"publisherId": "fcf32c99-a624-437b-9f47-9333ea128623"
}
}
}
10 changes: 5 additions & 5 deletions src/BsvProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,13 @@ import {
DocumentSymbol,
TextDocument,
Uri,
window,
workspace,
SymbolKind,
Range,
Position,
Location,
Hover,
extensions,
FileSystem,
CompletionItem,
LocationLink,
} from 'vscode';
Expand All @@ -245,6 +243,8 @@ import { extensionID } from './extension';
import { readFileSync } from 'fs';
import { join } from 'path';
import { readdirSync } from 'fs';
import { Logger } from './logger';
let logger: Logger = new Logger();

export interface BsvInfoProvider {
getSymbol(
Expand Down Expand Up @@ -3477,7 +3477,7 @@ class BsvStdLibProvider {
if (Object.prototype.hasOwnProperty.call(internalInfo, key)) {
const element = internalInfo[key];
const pp: String = element.package;
if (element.package != p) {continue;}
if (element.package != p) { continue; }
const type: String = element.type;
switch (type) {
case 'typeclass':
Expand Down Expand Up @@ -3591,7 +3591,7 @@ class BsvBaseInfoProvider {
this.parserCache.set(uri, tree);
this.updateSymbol(uri);

console.log('cache ' + uri);
logger.log('cache ' + uri);
} catch (error) { }
}

Expand Down Expand Up @@ -3861,7 +3861,7 @@ export class BsvInfoProviderManger {
workspace.workspaceFolders[0].uri
);
} else {
console.log('bsv only support one opened workspace now');
logger.log('bsv only support one opened workspace now');
}
}
}
39 changes: 0 additions & 39 deletions src/Logger.ts

This file was deleted.

20 changes: 8 additions & 12 deletions src/commands/ModuleInstantiation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as path from 'path';
import { Ctags, Symbol } from '../ctags';
import { window, QuickPickItem, workspace, SnippetString } from 'vscode';
import { Logger } from '../Logger';
import { Logger } from '../logger';

export function instantiateModuleInteract() {
let filePath = path.dirname(window.activeTextEditor.document.fileName);
Expand All @@ -21,7 +21,7 @@ function instantiateModule(srcpath: string): Thenable<SnippetString> {
let parametersName: string[] = [];
let logger: Logger = new Logger();
let ctags: ModuleTags = new ModuleTags(logger);
console.log('Executing ctags for module instantiation');
this.logger.log('Executing ctags for module instantiation');
ctags
.execCtags(srcpath)
.then((output) => {
Expand All @@ -40,7 +40,7 @@ function instantiateModule(srcpath: string): Thenable<SnippetString> {
return;
}
// Only one module found
else if (modules.length == 1) {module = modules[0];}
else if (modules.length === 1) { module = modules[0]; }
// many modules found
else if (modules.length > 1) {
moduleName = await window.showQuickPick(
Expand All @@ -51,7 +51,7 @@ function instantiateModule(srcpath: string): Thenable<SnippetString> {
placeHolder: 'Choose a module to instantiate',
}
);
if (moduleName === undefined) {return;}
if (moduleName === undefined) { return; }
module = modules.filter(
(tag) => tag.name === moduleName
)[0];
Expand All @@ -74,12 +74,12 @@ function instantiateModule(srcpath: string): Thenable<SnippetString> {
tag.parentScope === scope
);
parametersName = params.map((tag) => tag.name);
console.log(module);
this.logger.log(module.name);
let paramString = ``;
if (parametersName.length > 0) {
paramString = `\n#(\n${instantiatePort(parametersName)})\n`;
}
console.log(portsName);
this.logger.log(portsName.toString());
resolve(
new SnippetString()
.appendText(module.name + ' ')
Expand All @@ -97,7 +97,7 @@ function instantiatePort(ports: string[]): string {
let port = '';
let maxLen = 0;
for (let i = 0; i < ports.length; i++) {
if (ports[i].length > maxLen) {maxLen = ports[i].length;}
if (ports[i].length > maxLen) { maxLen = ports[i].length; }
}
// .NAME(NAME)
for (let i = 0; i < ports.length; i++) {
Expand Down Expand Up @@ -175,9 +175,7 @@ function getFiles(srcpath: string): string[] {

class ModuleTags extends Ctags {
buildSymbolsList(tags: string): Thenable<void> {
console.log('building symbols');
if (tags === '') {
console.log('No output from ctags');
return undefined;
}
// Parse ctags output
Expand All @@ -190,12 +188,10 @@ class ModuleTags extends Ctags {
tag.type === 'module' ||
tag.type === 'port' ||
tag.type === 'constant'
)
{this.symbols.push(tag);}
) { this.symbols.push(tag); }
}
});
// skip finding end tags
console.log(this.symbols);
return undefined;
}
}
Loading