Including righmost column when checking is-within-the-block #28983
Replies: 2 comments 3 replies
-
@nadeeshaan @dulajdilshan I had the same requirement in #28754 because the However, back then when I proposed the same, we did not change the |
Beta Was this translation helpful? Give feedback.
-
This was done intentionally. This check is left-inclusive and right-exclusive. This is done so that there isn't any overlapping boundaries which would mean a cursor position could match to multiple constructs. When you say We had this chat in the early days of the semantic API and decided to go with left-inclusive, right-exclusive approach. Originally it was picked because it was the intuitive approach. For example, say there's a var decl: I'll have a look at this query expr usage and see if this can be resolved in another way. |
Beta Was this translation helpful? Give feedback.
-
If I have kept my cursor in the below position.
the check to check whether the cursor is within the "string" block returns false (the current implementation). Shouldn't this be true?
Ref:
ballerina-lang/compiler/ballerina-lang/src/main/java/io/ballerina/compiler/api/impl/PositionUtil.java
Lines 44 to 48 in b678383
The origin of this issue came with the following ballerina code snippet.
(see the cursor position near the
where
)In this example, the issue of not getting
student
into the suggestions is the cursor position is considered asNot Within the Block
ofwhere-clause
Related issue: #28702
Beta Was this translation helpful? Give feedback.
All reactions