aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2021-03-30 16:07:23 +0200
committerDanielGavin <danielgavin5@hotmail.com>2021-03-30 16:07:23 +0200
commit228bda2c98624c9ae60f40b9be00c6c77f0a58c0 (patch)
treeab1b701a31b7da44e4e3c1ac91df98296a0776c2 /src/server
parent7c7893ff8f09e403dacc751b3c0c1a0233221450 (diff)
bound the slice of the fallback parsing
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index ae9c63a..78c4329 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2238,7 +2238,7 @@ fallback_position_context_completion :: proc(document: ^Document, position: comm
//this is most likely because of use of 'in', 'context', etc.
//try to go back one dot.
- src_with_dot := string(position_context.file.src[0:end_offset + 1]);
+ src_with_dot := string(position_context.file.src[0:min(len(position_context.file.src), end_offset + 1)]);
last_dot := strings.last_index(src_with_dot, ".");
if last_dot == -1 {