cucumber / vscode

Official Visual Studio Code Extension for Cucumber
MIT License
66 stars 17 forks source link

Work around TreeSitter incompatibility with Electron 22 #166

Closed xeger closed 1 year ago

xeger commented 1 year ago

πŸ€” What's changed?

Tweaked the web-tree-sitter WASM loader for synchronous operation.

To test these changes, install the pre-release VSIX file and then edit some Gherkin code.

⚑️ What's your motivation?

Fixes #164

VS Code 1.78 ships with Electron 22, and something has changed in V8 to make it hostile toward loading the tree-sitter language support WASM. It was recommended to loadAsync: false as a workaround, and lo, things seem to work if we monkey patch that workaround into the codebase.

There is no visible impact on performance.

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

This would seem like the only expedient way to restore the plugin's functionality. I've recruited some beta testers from Slack who will hopefully play with it before we publish it. Seems better than nothing, to me!

πŸ“‹ Checklist:

sijakret commented 1 year ago

i pulled you branch built the visx and did not observe any issues so far (checking atypescript project only, however)

xeger commented 1 year ago

After chatting with mpkorstanje, my plan of action for this PR is never to merge the branch. We'll release a version of the extension from this feature branch.

LukasLewandowski commented 1 year ago

Any update? :)

xeger commented 1 year ago

Sorry, no; I was waiting until Tree Sitter released their new major version, but I've since confirmed that it's still broken.

See tree-sitter/tree-sitter#2338 for details.

I will see about rebasing this branch off of a recent main (to pick up additional fixes) and then releasing.

xeger commented 1 year ago

FYI @LukasLewandowski and others -- I've built a new pre-release VSIX that you can install; it uses a less scary hack to work around the still-unresolved TreeSitter bug, and it upgrades several packages to improve the Gherkin editing experience. I will propose to the rest of the team that we release it as an official 1.8.0.

In the meantime, feel free to use the VSIX linked above and let me know if you have any problems. Thanks!

mrkaiser commented 1 year ago

@xeger I think it would behoove us to document in the README that we merged a potentially less than ideal solution and that it should be re-investigated regularly to see if we can go back to the mainline tree-sitter. Other than that :ship:

NutriMarc commented 1 year ago

I am still not getting cucumber language features on my feature files. I created these settings in my settings.json to try to fix it but to no avail. Can you help me get important cucumber features like clicking to step definition from feature files?

    "files.associations": {
        "*.feature": "feature"
    },
    "cucumber.features": [
        "oneOfManySubprojects/features/**/*.feature"
    ],
    "cucumber.glue": [
        "oneOfManySubprojects/step-definitions/**/*.js"
    ]
xeger commented 1 year ago

Closed this PR in favor of waiting for VS Code 1.82.0 which fixes the underlying incompatibility! πŸŽ‰