Skip to content

Commit 4609e16

Browse files
committed
JuliaSyntax version bump and REPL tweaks
1 parent 71329d5 commit 4609e16

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

deps/JuliaSyntax.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
JULIASYNTAX_BRANCH = main
2-
JULIASYNTAX_SHA1 = 46723f071d5b2efcb21ca6757788028afb91cc13
2+
JULIASYNTAX_SHA1 = e02f29f484389a8e48587b051c82663fe0caf03d
33
JULIASYNTAX_GIT_URL := https://github.com/JuliaLang/JuliaSyntax.jl.git
44
JULIASYNTAX_TAR_URL = https://api.github.com/repos/JuliaLang/JuliaSyntax.jl/tarball/$1

deps/checksums/JuliaSyntax-46723f071d5b2efcb21ca6757788028afb91cc13.tar.gz/md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/checksums/JuliaSyntax-46723f071d5b2efcb21ca6757788028afb91cc13.tar.gz/sha512

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
28e257cdc8906869e01f1754e2dd21af
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d84634ec7e7036c4a482a9705e948373cf1ac389936ee3f922147b101200a035c684277f5cb969970b09adaf40f00d0b6f2a81d4a0c0ea4b7fe966d777036151

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ function completions(string::String, pos::Int, context_module::Module=Main, shif
10431043
# `file ~/exa TAB => `file ~/example.txt
10441044
# `file ~/example.txt TAB => `file /home/user/example.txt
10451045
if (n = find_parent(cur, K"CmdString")) !== nothing
1046-
off = n.position - 1
1046+
off = char_first(n) - 1
10471047
ret, r, success = shell_completions(string[char_range(n)], pos - off, hint, cmd_escape=true)
10481048
success && return ret, r .+ off, success
10491049
end
@@ -1114,7 +1114,7 @@ function completions(string::String, pos::Int, context_module::Module=Main, shif
11141114
s = string[intersect(r2, 1:pos)]
11151115
elseif kind(cur) == K"MacroName"
11161116
# Include the `@`
1117-
r = intersect(prevind(string, cur.position):char_last(cur), 1:pos)
1117+
r = intersect(prevind(string, char_first(cur)):char_last(cur), 1:pos)
11181118
s = string[r]
11191119
elseif looks_like_ident || kind(cur) in KSet"Bool Identifier @"
11201120
r = intersect(char_range(cur), 1:pos)

stdlib/REPL/src/SyntaxUtil.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export CursorNode, char_range, char_last, children_nt, find_delim, seek_pos
1414
struct CursorData <: AbstractSyntaxData
1515
source::SourceFile
1616
raw::GreenNode{SyntaxHead}
17-
position::Int
17+
byte_end::Int
1818
index::Int
1919
index_nt::Int # nth non-trivia in parent
2020
val::Any
@@ -71,8 +71,9 @@ function Base.Expr(node::CursorNode)
7171
Expr(SyntaxNode(src, node.raw))
7272
end
7373

74-
char_range(node) = node.position:char_last(node)
75-
char_last(node) = thisind(node.source, node.position + span(node) - 1)
74+
char_range(node) = char_first(node):char_last(node)
75+
char_first(node) = node.byte_end - node.raw.span + 1
76+
char_last(node) = thisind(node.source, node.byte_end)
7677

7778
children_nt(node) = [n for n in children(node) if !is_trivia(n)]
7879

@@ -103,7 +104,7 @@ function find_delim(node, left_kind, right_kind)
103104
left !== nothing || return nothing, nothing
104105
right = findlast(c -> kind(c) == right_kind, cs)
105106
closed = right !== nothing && right != left
106-
right = closed ? thisind(node.source, cs[right].position - 1) : char_last(node)
107+
right = closed ? char_first(cs[right]) : char_last(node)
107108
left = nextind(node.source, char_last(cs[left]))
108109
return left:right, closed
109110
end

0 commit comments

Comments
 (0)