Skip to content

[BUG] The formatter cannot be worked without workspaceFolders #521

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

Open
UrMyLacia opened this issue Apr 29, 2025 · 0 comments
Open

[BUG] The formatter cannot be worked without workspaceFolders #521

UrMyLacia opened this issue Apr 29, 2025 · 0 comments
Labels

Comments

@UrMyLacia
Copy link

Describe the bug
A clear and concise description of what the bug is.

Environment (please complete the following information):

  • OS: Windows 11 24H2 build 26100.3915]
  • VS Code version 1.99.3
  • Extension version 1.16.0
  • verible-verilog-format v0.0-3973-g904f446f

Steps to reproduce
Steps to reproduce the behavior:

Directly open vscode and then open the file
Directly open vscode and create a new v/sv File
Use code [PathToFile] to open
Etc.
In summary, the situation is that execute Formatter without workspaceFolders

Log
Output -> Verilog

2025-04-29 19:44:20.974 [info] [SystemVerilogFormatProvider] Temp file created at:C:\Path\To\Temp\veribleVerilogFormatter-fc9e776196dbce107afd4e585f300c03.tmp.sv
2025-04-29 19:44:20.974 [info] [SystemVerilogFormatProvider] Executing command: verible-verilog-format --inplace C:\Path\To\Temp\veribleVerilogFormatter-fc9e776196dbce107afd4e585f300c03.tmp.sv
2025-04-29 19:44:20.974 [error] [SystemVerilogFormatProvider] TypeError: Cannot read properties of undefined (reading '0')

Expected behavior
Format should be executed

Actual behavior
No changes

Causes of the problem
I tracked the and the problem stemmed from no workspace in variable workspaceFolders

child_process.execFileSync(binPath, args, {cwd: vscode.workspace.workspaceFolders[0].uri.fsPath});

If vscode is not opened in the worksapce, workspaceFolders cannot be indexed
The last commit of this file caused this problem. Perhaps we should check whether workspace exists in workspaceFolders

By the way, why not print the stack information in the catch? (Maybe I haven't found how to view it)

@UrMyLacia UrMyLacia added the bug label Apr 29, 2025
@UrMyLacia UrMyLacia changed the title [BUG] The formatter cannot be used without workspaceFolders [BUG] The formatter cannot be worked without workspaceFolders Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant