Skip to content

Commit 1c17ff8

Browse files
mlechuaviatesk
andauthored
Small fixes for CI (#295)
* Small fixes for CI * completions: fix macro detection * Update test/test_diagnostics.jl --------- Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
1 parent fd45dcb commit 1c17ff8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/completions.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,20 @@ function global_completions!(items::Dict{String, CompletionItem}, state::ServerS
186186
if prev_kind === JS.K"@"
187187
edit_start_pos = offset_to_xy(fi, JS.first_byte(prev_token))
188188
is_macro_invoke = true
189-
# Case: `@macr│`
190-
elseif prev_kind === JS.K"macro_name"
191-
edit_start_pos = offset_to_xy(fi, JS.first_byte(prev_tok(prev_token)))
192-
is_macro_invoke = true
193189
# Case `│` (empty program)
194190
elseif isnothing(prev_token)
195191
edit_start_pos = Position(; line=0, character=0)
196192
is_macro_invoke = false
197193
elseif JS.is_identifier(prev_kind)
198-
edit_start_pos = offset_to_xy(fi, JS.first_byte(prev_token))
199-
is_macro_invoke = false
194+
pprev_token = prev_tok(prev_token)
195+
if !isnothing(pprev_token) && JS.kind(pprev_token) === JS.K"@"
196+
# Case: `@macr│`
197+
edit_start_pos = offset_to_xy(fi, JS.first_byte(pprev_token))
198+
is_macro_invoke = true
199+
else
200+
edit_start_pos = offset_to_xy(fi, JS.first_byte(prev_token))
201+
is_macro_invoke = false
202+
end
200203
else
201204
# When completion is triggered within unknown scope (e.g., comment),
202205
# it's difficult to properly specify `edit_start_pos`.

src/utils/binding.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function jl_lower_for_scope_resolution(
6464
JETLS_DEBUG_LOWERING && showerror(stderr, err)
6565
JETLS_DEBUG_LOWERING && Base.show_backtrace(stderr, catch_backtrace())
6666
st0 = without_kinds(st0, JS.KSet"macrocall")
67-
JL.expand_forms_1(mod, st0, true)
67+
JL.expand_forms_1(mod, st0, true, Base.get_world_counter())
6868
end
6969
return _jl_lower_for_scope_resolution(ctx1, st0, st1)
7070
end

0 commit comments

Comments
 (0)