Skip to content

feat : field completions#615

Open
Sypher845 wants to merge 2 commits intoaviatesk:avi/ASTTypeAnnotatorfrom
Sypher845:feat/field-completions
Open

feat : field completions#615
Sypher845 wants to merge 2 commits intoaviatesk:avi/ASTTypeAnnotatorfrom
Sypher845:feat/field-completions

Conversation

@Sypher845
Copy link
Copy Markdown

Kooha-2026-04-02-04-49-59

This PR adds field completion support to JETLS. When a user types x. and triggers completions (e.g., via Ctrl+Space), the server now suggests available fields for the inferred type of x.

@Sypher845 Sypher845 force-pushed the feat/field-completions branch from d1194a9 to 23641b8 Compare April 1, 2026 23:36
Implement the `ASTTypeAnnotator` pipeline, which takes a `SyntaxTree`,
generates `CodeInfo` from it, and performs type annotation via abstract
interpretation.
By maintaining a reverse mapping from `CodeInfo` back to `SyntaxTree`,
we can trace from a specific statement in `CodeInfo` to its source
representation.

This is needed for implementing type on hover, inlay type hints, and
property completions, etc.

Marked as WIP since there are still many edge cases and inference
result caching is not yet implemented.
@aviatesk
Copy link
Copy Markdown
Owner

aviatesk commented Apr 4, 2026

This PR implements .-completion as "field completion", but in Julia, x.y is actually not a field access but it's a property access. That means x.-completion needs to be implemented in a way that emulates the behavior of getproperty(::typeof(x), ::Symbol). The current implementation calls fieldnames on the inferred type, which is the most reliable but incomplete way to statically emulate getproperty. Do you have any ideas on this?

Also, there should be additional points to discuss:

  • ASTTypeAnnotator probably expects a complete AST in most cases. However, code like xxx.| might produce an incomplete AST. I'd like you to investigate what happens in which cases, and check whether the current approach still works fine.
  • Please improve the completion trigger logic so that .| automatically triggers completion.

Lastly, please rebase this PR and set #620 as the merge target.

Comment thread src/completions.jl Outdated
Comment thread src/hover.jl Outdated
@Sypher845 Sypher845 force-pushed the feat/field-completions branch from 23641b8 to b56705b Compare April 7, 2026 08:43
@Sypher845 Sypher845 changed the base branch from master to avi/ASTTypeAnnotator April 7, 2026 08:52
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the feat/field-completions branch from b56705b to 3fc3361 Compare April 9, 2026 08:52
@Sypher845
Copy link
Copy Markdown
Author

@aviatesk i have addressed the main review points,

  • . now triggers completion automatically.
  • dot completion now handles properties, not only fields.
  • typed local dot completion still works, including incomplete cases like p. .
  • displayed type details are postprocessed before showing them.

Current limitation:
for inferred non-constant values, custom property completion currently works for simple static propertynames(::T) cases, but not for all dynamic getproperty cases.

Please take a look when you have time

@aviatesk aviatesk force-pushed the avi/ASTTypeAnnotator branch from e355af5 to 355440b Compare April 14, 2026 10:05
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 72.81553% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.23%. Comparing base (16ca32f) to head (3fc3361).
⚠️ Report is 28 commits behind head on avi/ASTTypeAnnotator.

Files with missing lines Patch % Lines
src/completions.jl 64.88% 46 Missing ⚠️
src/analysis/ASTTypeAnnotator.jl 84.10% 24 Missing ⚠️
src/utils/inference.jl 45.45% 12 Missing ⚠️
src/utils/binding.jl 60.00% 2 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           avi/ASTTypeAnnotator     #615      +/-   ##
========================================================
+ Coverage                 69.14%   69.23%   +0.09%     
========================================================
  Files                        51       53       +2     
  Lines                      8734     9034     +300     
========================================================
+ Hits                       6039     6255     +216     
- Misses                     2695     2779      +84     
Flag Coverage Δ
JETLS.jl 69.23% <72.81%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aviatesk aviatesk force-pushed the avi/ASTTypeAnnotator branch from 355440b to 1058286 Compare April 14, 2026 15:38
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