Skip to content

Fallback to WASM tree-sitter parser#393

Open
kddejong wants to merge 1 commit intomainfrom
feature/wasmparser
Open

Fallback to WASM tree-sitter parser#393
kddejong wants to merge 1 commit intomainfrom
feature/wasmparser

Conversation

@kddejong
Copy link
Collaborator

Issue #, if available:

Description of changes:

  • Fallback to WASM tree-sitter parser

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kddejong kddejong requested a review from a team as a code owner January 14, 2026 23:26
test: /\.wasm$/,
type: 'asset/resource',
generator: {
filename: '[name][ext]',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be [name].[ext]?

}

// Environment detection and factory creation
const shouldForceWasm = (): boolean => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check whether we are on legacy linux instead of checking environment variable? Think this can just be a variable instead of a function

log.info('Forcing WASM tree-sitter implementation (CLOUDFORMATIONLSP_USE_WASM=true)');
const wasmFactory = new WasmParserFactory();
// eslint-disable-next-line unicorn/prefer-top-level-await
wasmFactory.initialize().catch((error: unknown) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If initialization fails, should it fallback to native?

// Initialize the factory - async initialization happens in background
let factoryInstance: ParserFactory;

if (shouldForceWasm()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to run some of the e2e/integration tests with this flag enabled so we know everything is working correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants