Skip to content
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

bug: tree-sitter-typescript not working with my tree-sitter library in javascript #292

Closed
2 tasks done
precious112 opened this issue Apr 21, 2024 · 1 comment · Fixed by #294
Closed
2 tasks done
Labels

Comments

@precious112
Copy link

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-typescript

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

I have been trying to get tree-sitter-typescript to work in javascript but i's not working always throwing the error Invalid language object but tree-sitter works well with tree-sitter-javascript and tree-sitter-python. here's my code :

const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Steps To Reproduce/Bad Parse Tree

```const path = require('path');
const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Expected Behavior/Parse Tree

```const path = require('path');
const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Repro

```TypeScript
// Example code that causes the issue
function foo() {
  // Code that fails to parse, or causes an error
}
@kamoshi
Copy link

kamoshi commented Apr 22, 2024

I'm pretty sure this is because this package has not been updated to be compatible with tree sitter v21. I'm having a similar problem with the Rust crate - the Language struct is incompatible with tree-sitter v21

@amaanq amaanq mentioned this issue May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants