mike-lischke / vscode-antlr4

ANTLR4 language support for Visual Studio Code
http://www.soft-gems.net
MIT License
436 stars 61 forks source link

debug grammar no longer seems to work #221

Closed dannyb2018 closed 1 year ago

dannyb2018 commented 1 year ago

Had two existing grammar that were working with previous version of the extension - 2.3.1 - and now it is saying:

Error: Debugger creation failed. You are either trying to debug an unsupported file type or no interpreter data has been generated yet for the given grammar

mike-lischke commented 1 year ago

Can you describe how you started debugging? Share your launch config here too.

dannyb2018 commented 1 year ago
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
       {
            "name": "Debug hedge strategies ANTLR4 grammar",
            "type": "antlr-debug",
            "request": "launch",
            "input": "./src/main/java/ai/liquidmarkets/structured_products/server/grammar/hedge_strategies/strategies/call_spread.hs",
            "grammar": "./src/main/java/ai/liquidmarkets/structured_products/server/grammar/hedge_strategies/grammar/QPHedgeStrategy.g4",
            "startRule": "hedgeStrategy",
            "printParseTree": true,
            "visualParseTree": true
        }
    ]
}

I can add the grammar files too but they havent changed since the previous version that worked

Andreev-Sergey commented 1 year ago

Hi. I found a similar problem. After debugging extension it seems that error in backend/facade.ts: loadGrammar. The parameter "fileName" is from editor.document.fileName and has absolute path in my case, so combining it with current working dir leads to an exception. Changing fs.statSync(path.join(process.cwd(), fileName)); line to fs.statSync(fileName); works fine for me.

mike-lischke commented 1 year ago

Odd, isn't join supposed to take care of absolute paths? Need to investigate. Thanks for digging into the code @Andreev-Sergey.

dannyb2018 commented 1 year ago

Should mention I am running on Linux Ubuntu 22.04.03 so is not just a windows issue

Let me try to verify it is the same issue

mike-lischke commented 1 year ago

Fixed by commit c537c2c

michaelp commented 1 year ago

@mike-lischke when will this fix be published to the VSCODE marketspace ?