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

Use AST #109

Draft
wants to merge 152 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
6f7ed6f
converting var declaration initialization
pherrymason Aug 7, 2024
09c3aa0
WIP CST to AST converter: VarDecl support initializing to more expres…
pherrymason Aug 8, 2024
174abd5
Simplify test compile_time_call
pherrymason Aug 8, 2024
c0a5594
Fix Import tests.
pherrymason Aug 8, 2024
bbe9bca
Build job depends on test.
pherrymason Aug 8, 2024
261f945
Fix import test.
pherrymason Aug 8, 2024
5d33331
testing running job manually
pherrymason Aug 8, 2024
0926972
Tweak
pherrymason Aug 8, 2024
0e9e317
Fix compile_time_call test.
pherrymason Aug 9, 2024
0e1647a
Convert compile time functions.
pherrymason Aug 10, 2024
d479668
Tweak Lambda body definition.
pherrymason Aug 10, 2024
5e3da93
Extract convert_function_parameter_list
pherrymason Aug 10, 2024
70cc733
Convert lambda parameters.
pherrymason Aug 10, 2024
bc97b09
Convert assignment expressions
pherrymason Aug 11, 2024
3d241b6
test for assignment expression with ct_type_ident
pherrymason Aug 11, 2024
3e4af51
Fix tests after updating Treesitter.
pherrymason Aug 13, 2024
013f66d
WIP Node rule system to define more easily those nodes that allow dif…
pherrymason Aug 13, 2024
affcd75
Complete lambda_expr test.
pherrymason Aug 14, 2024
0f217d1
Convert elvis or else.
pherrymason Aug 14, 2024
cafce0d
Implement convert optional expr. Still missing test
pherrymason Aug 15, 2024
26b564c
Fix convert_optional_expr and add a test for it.
pherrymason Aug 17, 2024
918e4c7
Fix parser.typeNodeToType
pherrymason Aug 17, 2024
fad60c5
Fix convert_optional_expr when single ? is used.
pherrymason Aug 17, 2024
cabb9d7
Implement convert_unary_expression
pherrymason Aug 17, 2024
858265c
Fix test
pherrymason Aug 17, 2024
9ce6227
Implement convert_cast_expression
pherrymason Aug 17, 2024
9ced021
WIP convert_call_expr
pherrymason Aug 17, 2024
563eca3
Finish convert_rethrow_expr
pherrymason Aug 17, 2024
c6d427c
store language keywords in a set instead of a slice
nikpivkin Aug 15, 2024
8ba3160
bump version.
pherrymason Aug 17, 2024
3e4970b
Convert trailing block in call_expr
pherrymason Aug 17, 2024
997b796
Convert trailing generic expression.
pherrymason Aug 17, 2024
6d90728
Convert update_expr
pherrymason Aug 17, 2024
b406bef
Convert subscript expression
pherrymason Aug 18, 2024
4163b72
extract convert_initializer_list
pherrymason Aug 18, 2024
4e1e858
Refactor convert_base_expr.
pherrymason Aug 18, 2024
40480c6
Add cgo flags
pherrymason Aug 18, 2024
96241b8
convert declaration_stmt
pherrymason Aug 18, 2024
b2393cb
Implement declaration_stmt for constants and variables.
pherrymason Aug 19, 2024
983cb5f
Convert continue statements.
pherrymason Aug 19, 2024
5c3a455
Convert break statements.
pherrymason Aug 19, 2024
69e2dc8
WIP convert_switch_statement
pherrymason Aug 19, 2024
6a338ac
Support converting cases on types.
pherrymason Aug 19, 2024
aa0f6df
Support converting cases with ranges.
pherrymason Aug 19, 2024
4e4127e
Convert nextcase
pherrymason Aug 20, 2024
74114d4
WIP: Convert if stmt.
pherrymason Aug 20, 2024
6b5b0c3
Convert if stmt: Parse simple condition literal.
pherrymason Aug 20, 2024
0544f42
Convert if stmt:
pherrymason Aug 20, 2024
922d5e2
Convert if stmt:
pherrymason Aug 20, 2024
1cf66a8
WIP for_statement
pherrymason Aug 24, 2024
2db60b1
Fix parsing for initializer.
pherrymason Aug 31, 2024
0a021ba
Improve initialization, condition and update nodes of for statement.
pherrymason Sep 1, 2024
eb3aa58
Fix for_statement test
pherrymason Sep 4, 2024
65c33dd
Add new test for for_stmt
pherrymason Sep 6, 2024
5748366
Convert for stmt body
pherrymason Sep 6, 2024
9c03c56
WIP foreach_stmt
pherrymason Sep 8, 2024
5bb0497
Parse foreach_cond
pherrymason Sep 8, 2024
de70716
foreach_stmt: flag type as reference.
pherrymason Sep 8, 2024
02434cd
foreach_stmt: parse index + value.
pherrymason Sep 8, 2024
f3ff071
foreach_stmt: parse body.
pherrymason Sep 8, 2024
a3768cf
convert while_stmt
pherrymason Sep 8, 2024
d497b5d
convert do_stmt
pherrymason Sep 8, 2024
b7715ea
convert defer_stmt
pherrymason Sep 8, 2024
fcdd0f4
convert assert_stmt
pherrymason Sep 8, 2024
1cba10b
merge files
pherrymason Sep 8, 2024
e0c9997
WIP traversing the ast with a JSONVisitor
pherrymason Sep 10, 2024
e918ca2
testing other Module definition
pherrymason Sep 13, 2024
9af025c
Rever test
pherrymason Sep 15, 2024
bc7783b
Add kind property to ast nodes.
pherrymason Sep 16, 2024
c76adea
serialize more elements.
pherrymason Sep 20, 2024
7401a88
Refactor ast node tree generation
pherrymason Nov 24, 2024
6e66cfb
Fix test
pherrymason Nov 24, 2024
614a5ed
- Change JSON AST structure.
pherrymason Nov 24, 2024
3e3f50e
- Change JSON AST structure.
pherrymason Nov 24, 2024
f5ea2c6
Advance in converting CST to AST.
pherrymason Dec 3, 2024
d8351e8
renamed concepts
pherrymason Dec 4, 2024
f8c66b1
Better error description on failing to convert a node to ast.
pherrymason Dec 4, 2024
a190d1b
WIP creating symbol collector from ast.
pherrymason Dec 9, 2024
c5f91a2
- Convert "paren_expr"
pherrymason Dec 10, 2024
657d9ec
WIP building symbol table.
pherrymason Dec 26, 2024
ead6dd8
Fix test.
pherrymason Dec 26, 2024
637f15b
Fix tests
pherrymason Dec 26, 2024
cecefda
Remove remaining debug calls.
pherrymason Dec 26, 2024
ff741e7
Implement parsing def declaring function types.
pherrymason Dec 26, 2024
48fee6e
AST build: Fix anonymous module not getting right end range.
pherrymason Dec 27, 2024
c4b4c91
Fix tests
pherrymason Jan 6, 2025
4b21c08
Externalize IdGenerator so tests on convert don't need to check right…
pherrymason Jan 6, 2025
549eb87
Fix symbol_table_tests and analysis_test
pherrymason Jan 6, 2025
2382b67
Build symbol table: detect local variable declarations.
pherrymason Jan 6, 2025
5443e56
FindSymbol allows to specify desired scopeStack.
pherrymason Jan 6, 2025
758184b
Analysis: Add test for "Find local variable declaration in function a…
pherrymason Jan 6, 2025
c2ea63e
Convert expr_block
pherrymason Jan 6, 2025
a589397
Rewrite FindSymbol to work directly with the scopeStack present in th…
pherrymason Jan 9, 2025
49d953f
Support searching definition of struct properties reading/writing.
pherrymason Jan 14, 2025
a3e4f00
Fix building symbols for struct methods.
pherrymason Jan 14, 2025
9a7105e
Fix Scope.RegisterSymbol signature.
pherrymason Jan 14, 2025
ef04012
Fix convert tests.
pherrymason Jan 14, 2025
8b21a99
Fix ast factory tests.
pherrymason Jan 14, 2025
e32737d
Fix convert_field_expr: Set proper range positions.
pherrymason Jan 16, 2025
ac1f2b2
Fix test
pherrymason Jan 16, 2025
192f6da
Fix finding struct property returned by plain function call.
pherrymason Jan 14, 2025
8609e56
Fix test "Should find function definition without body"
pherrymason Jan 14, 2025
00bec63
Improve finding symbols in a SelectorExpr.
pherrymason Jan 17, 2025
d224bdc
Reorganize server to keep a symbol table.
pherrymason Jan 17, 2025
88fcbc0
Fix last ast.Module found not having right range end.
pherrymason Jan 17, 2025
fc6597c
Fix parsing ranges of Enum Values.
pherrymason Jan 19, 2025
5409a76
Fix test
pherrymason Jan 19, 2025
1aee0ba
Register fault member symbols, and be able to find them.
pherrymason Jan 19, 2025
e8cdafc
Register enum value and fault value symbols
pherrymason Jan 19, 2025
bc8c53d
Add test to find enum method.
pherrymason Jan 19, 2025
ed9ae3c
Add trap to find enum method test and fix algorithm.
pherrymason Jan 19, 2025
3d696c5
Add test to find fault methods.
pherrymason Jan 19, 2025
8c81947
Support searching methods on `self`.
pherrymason Jan 19, 2025
2fdd9ab
Walk: Cover more ast nodes
pherrymason Jan 19, 2025
8391c3a
Fix solveSelAtSelectorExpr when X is TypeInfo (accessing a enum/fault…
pherrymason Jan 19, 2025
8f98694
Fix test
pherrymason Jan 19, 2025
9a93a1f
Implement searching in imported modules if symbol not found in curren…
pherrymason Jan 20, 2025
ce52b86
Search in implicit submodules.
pherrymason Jan 20, 2025
e87f0b0
Change StructDecl.Implements to []*ast.Ident so cursor position can b…
pherrymason Jan 20, 2025
39b5934
Search in inlined struct properties.
pherrymason Jan 20, 2025
bda53ba
update notes
pherrymason Jan 22, 2025
1d04d14
Implement basic hover functionality using new algorithms.
pherrymason Jan 21, 2025
8bfbe06
Improve Path Ident handling.
pherrymason Jan 22, 2025
c67dc36
Add new test for searching symbol in external file, different module.
pherrymason Jan 22, 2025
5995a92
Improve finding anonymous substruct fields.
pherrymason Jan 24, 2025
3dfca75
Flag anonymous structs more explicitly in Symbols
pherrymason Jan 26, 2025
647945f
Refactor SymbolTable.FindSymbolByPosition
pherrymason Jan 26, 2025
2522528
AST generation: Fix module end range in some scenarios.
pherrymason Jan 26, 2025
f5dbe08
Bump version
pherrymason Jan 28, 2025
d43c819
Flag Ident with compiletime flags.
pherrymason Jan 28, 2025
06a4fbe
Use pointers for Ident and TypeInfo and rest of nodes.
pherrymason Jan 28, 2025
cf67047
Fix things that broke with rebase.
pherrymason Jan 28, 2025
cfa2be1
Fix parsing function call arguments.
pherrymason Jan 28, 2025
f17739a
Add test to parsing type.
pherrymason Jan 28, 2025
de8d995
Replace Identity Builder BuildPtr() by Build()
pherrymason Jan 28, 2025
6421c1d
Update parsing initializer_list_assignment test
pherrymason Jan 28, 2025
6a44383
Port parsing doc comments from 0.4.0.
pherrymason Jan 28, 2025
75fb177
Fix bad rebase in Diagnostics
pherrymason Jan 28, 2025
dd311d1
Entry point for Document Completion.
pherrymason Jan 28, 2025
b9154e0
Port dedent docstring body (#f7c512937e49ae4d378cccac2930ea7993be6eb6)
pherrymason Jan 28, 2025
4f67fa6
Test for signature helper.
pherrymason Jan 29, 2025
562f9cc
Simplify converting builtin call expressions and flag them as compile…
pherrymason Jan 31, 2025
bdce42b
Refactor.
pherrymason Feb 2, 2025
f0884dc
Port fix parsing doc comments with only contracts(#d8ab552928cf4ff4da…
pherrymason Feb 2, 2025
a7d62c0
Respect original order of hover info
pherrymason Feb 2, 2025
7c8be93
Sort test
pherrymason Feb 2, 2025
ac8a3ff
Port fix macro keyword on hover (#15fd448c4013c583369c156943a714958d0…
pherrymason Feb 2, 2025
3ae2d41
Port fix crash on incomplete macro (#9ecf956d92b3111b1a4213e174c0d2d5…
pherrymason Feb 2, 2025
59201cb
Port parse macro return type(#5e63bfb15850172317b79a5c7847dabb8dacbc9b)
pherrymason Feb 2, 2025
23d64c8
Port parse macro method type(#14aaa7260b8b243669d0d6f096e1d92ea379b252)
pherrymason Feb 3, 2025
95e0db0
Port from 0.4.0 improvements on def symbols.
pherrymason Feb 3, 2025
08e49b7
Port from 0.4.0 improvements on def symbols.
pherrymason Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
test:
Expand All @@ -23,6 +24,8 @@ jobs:
run: cd server && go test -v ./...
build:
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
-
name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ assets
tree-sitter-c3
parser/chumsky
server/internal/parser
server/internal/lsp/ast/ast.json
server/bin
dist/
docs/help
2 changes: 2 additions & 0 deletions bin/build_index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ if [ -z "$VERSION" ]; then
exit 1
fi

echo "C3C_DIR: $C3C_DIR"
echo "VERSION: $VERSION"
cd "$C3C_DIR" && git fetch --all && git reset --hard origin/master && git checkout tags/v"$VERSION"
cd ../../server/cmd/stdlib_indexer && go run main.go blurp.go --"$VERSION"
14 changes: 14 additions & 0 deletions bin/downloads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import requests

owner = "pherrymason"
repo = "c3-lsp"
h = {"Accept": "application/vnd.github.v3+json"}
u = f"https://api.github.com/repos/{owner}/{repo}/releases?per_page=10"
r = requests.get(u, headers=h).json()
#r.reverse() # older tags first
for rel in r:
if rel['assets']:
tag = rel['tag_name']
dls = rel['assets'][0]['download_count']
pub = rel['published_at']
print(f"Pub: {pub} | Tag: {tag} | Dls: {dls} ")
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# C3LSP Release Notes

## 0.5

- Simplify search code: Based now on visitor pattern traversing an actual AST built from treesitter's CST.
- Better handling following chained expressions.
- Goto on module offers multiple locations.

## 0.4.0

- Support <* and *> comments (https://github.com/pherrymason/c3-lsp/pull/99) Credit to @PgBiel
Expand All @@ -16,6 +22,7 @@


## 0.3.3

- Support named and anonymous sub structs.
- Fix clearing old diagnostics. (#89, #83, #71, #62)
- Fixed crash in some scenarios where no results were found.
Expand Down
44 changes: 0 additions & 44 deletions client/vscode/dist/extension.js

This file was deleted.

2 changes: 1 addition & 1 deletion client/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}
}
},
"main": "./dist/extension.js",
"main": "./extension.js",
"dependencies": {
"vscode-languageclient": "^9.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion server/cmd/lsp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/pherrymason/c3-lsp/internal/lsp/server"
)

const version = "0.4.0"
const version = "0.5.0"
const prerelease = true
const appName = "C3-LSP"

Expand Down
Loading
Loading