mshr-h / vscode-verilog-hdl-support

HDL support for VS Code
MIT License
290 stars 76 forks source link

[BUG] Linter fails with "Cannot read property 'logger' of undefined" #89

Open gtsiam opened 4 years ago

gtsiam commented 4 years ago

Bug description Linting of a verilog file produces the error Cannot read property 'logger' of undefined. As far as I can tell this isn't limited to modelsim, but I only have modelsim installed.

Environment

Steps to reproduce Steps to reproduce the behavior:

  1. Open a simple verilog file with VS Code. (for me, the file was in the current vs code workspace).
  2. Hit Ctrl+Shift+P
  3. Run Verilog: Rerun lint tool
  4. Select ModelSim and hit enter
  5. Error appears as a popup within vscode on the bottom right.

As for the file, I tested both:

module a;
endmoudk

and

module a;
endmodule

with the same error.

Log The only useful logs I could find where from the developer tools: image

Expected behavior I should see some linter output.

Actual behavior I didn't see any linter output.

Additional Context My username has greek characters in it, so maybe a unicode error? The project files however, are under C:\, so maybe that's unlikely.

This was broken by version 1.0.4. Looking at the changelog, I see changes to logger on 1.0.4, and it works fine on 1.0.3.

Brac24 commented 4 years ago

Try using Icarus Verilog. I was getting the same error. All I did to solve it was installing Icarus Verilog and then adding this directory to my PATH system environment variable.

gtsiam commented 4 years ago

This bug is for Modelsim (I was required to used modelsim in particular for my projects). But I would think it also applies to iverilog.

Even if it runs with iverilog, the bug remains. I dug a bit more into the code, but I know next to nothing about vscode extensions, so please - if one of the devs could take a look (@Raamakrishnan according to git blame, that's you):

The code I'm running (after transpilation I assume), is:

    RunLintTool() {
        return __awaiter(this, void 0, void 0, function* () {
            // Check for language id
            let lang = vscode_1.window.activeTextEditor.document.languageId;
            if (vscode_1.window.activeTextEditor === undefined || (lang !== "verilog" && lang !== "systemverilog"))
                vscode_1.window.showErrorMessage("Verilog HDL: No document opened");
            // else if(window.activeTextEditor.document.languageId !== "verilog")
            // window.showErrorMessage("Verilog HDL: No Verilog document opened");
            else {
                // Show the available linters
                let linterStr = yield vscode_1.window.showQuickPick([
                    { label: "iverilog",
                        description: "Icarus Verilog",
                    },
                    { label: "xvlog",
                        description: "Vivado Logical Simulator"
                    },
                    { label: "modelsim",
                        description: "Modelsim"
                    },
                    { label: "verilator",
                        description: "Verilator"
                    }
                ], { matchOnDescription: true,
                    placeHolder: "Choose a linter to run",
                });
                if (linterStr === undefined)
                    return;
                // Create and run the linter with progress bar
                let tempLinter;
                switch (linterStr.label) {
                    case "iverilog":
                        tempLinter = new IcarusLinter_1.default(this.logger);
                        break;
                    case "xvlog":
                        tempLinter = new XvlogLinter_1.default(this.logger);
                        break;
                    case "modelsim":
                        tempLinter = new ModelsimLinter_1.default(this.logger);
                        break;
                    case "verilator":
                        tempLinter = new VerilatorLinter_1.default(this.logger);
                        break;
                    default:
                        return;
                }
                yield vscode_1.window.withProgress({
                    location: vscode_1.ProgressLocation.Notification,
                    title: "Verilog HDL: Running lint tool..."
                }, (progress, token) => __awaiter(this, void 0, void 0, function* () {
                    tempLinter.removeFileDiagnostics(vscode_1.window.activeTextEditor.document);
                    tempLinter.startLint(vscode_1.window.activeTextEditor.document);
                }));
            }
        });
    }
}

From out/src/LintManager.js

You can see this is overridden when the generator function is defined. Anyway, this may have been introduced by the transpilation - In short I doubt this is a missing tool problem.

Brac24 commented 4 years ago

Got it. As a sanity check you can run the simulator in a command prompt correct?

gtsiam commented 4 years ago

Yes, it works fine: (I run vlog -lint .\select8.v). And for reference, downgrading to (extension version) 1.0.3 works fine as well.

tarikgraba commented 4 years ago

Same error when using Verilator on a Debian 10 machine.

The verilator command is in the PATH and works as expected when called with --lint-only as argument.

Raamakrishnan commented 4 years ago

The Rerun lint tool command has been broken for quite a while (#55). I wouldn't use it. The file will be automatically linted on saving it. So, that should be good for most of the cases.