feat(graph): add Go language extractor - #133
Open
0xmohit wants to merge 1 commit into
Open
Conversation
Add code-graph extraction support for Go using tree-sitter-go grammar (https://github.com/tree-sitter/tree-sitter-go). - New `src/graph/extraction/languages/go.ts` with `GoWalker` extracting: structs (class), interfaces, type aliases, functions, methods, generics, imports, calls, struct instantiations, field types. - New fixture `src/graph/__tests__/fixtures/sample.go` and 11 tests in `extractor-go.test.ts` covering declarations, containment, references, generics, and docstrings. - Register Go in `languages/index.ts` and `grammars.ts` (`.go` extension). - Vendor `tree-sitter-go.wasm` from tree-sitter-wasms@0.1.13. Update docs: `docs/code-graph-support.md` (Go now Supported), `docs/extractors.md` (grammar source documentation). Fix `src/graph/extraction/node-id.ts`: add guard in `getNodeText()` for nodes missing `startIndex`/`endIndex` (tree-sitter-go comment nodes lack byte offsets when accessed via `previousSibling`). Fixes mex-memory#93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add code-graph extraction support for Go using tree-sitter-go grammar (https://github.com/tree-sitter/tree-sitter-go).
src/graph/extraction/languages/go.tswithGoWalkerextracting: structs (class), interfaces, type aliases, functions, methods, generics, imports, calls, struct instantiations, field types.src/graph/__tests__/fixtures/sample.goand 11 tests inextractor-go.test.tscovering declarations, containment, references, generics, and docstrings.languages/index.tsandgrammars.ts(.goextension).tree-sitter-go.wasmfrom tree-sitter-wasms@0.1.13.Update docs:
docs/code-graph-support.md(Go now Supported),docs/extractors.md(grammar source documentation).Fix
src/graph/extraction/node-id.ts: add guard ingetNodeText()for nodes missingstartIndex/endIndex(tree-sitter-go comment nodes lack byte offsets when accessed viapreviousSibling).Fixes #93
What
Why
Type of change
How to test
Checklist
npm test)Code-graph changes
mainLanguageExtractororFrameworkResolverinterfacecore / discuss-firstissue is linked above