Skip to content

Commit f6a265c

Browse files
committed
Fix cases where if was no greedy enough, we now use the correct regex instead
Closes #216
1 parent 45eefdc commit f6a265c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util/treeUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type NodeType =
1111
| "Module"
1212
| "UnionConstructor";
1313

14+
const functionNameRegex: RegExp = new RegExp("[a-zA-Z0-9_]+");
15+
1416
export type Exposing = {
1517
name: string;
1618
syntaxNode: SyntaxNode;
@@ -1043,7 +1045,7 @@ export class TreeUtils {
10431045
.split("\n")
10441046
[position.line].substring(previousCharColumn, position.character);
10451047

1046-
if (charBeforeCursor === " " || charBeforeCursor === "") {
1048+
if (!functionNameRegex.test(charBeforeCursor)) {
10471049
return node.namedDescendantForPosition({
10481050
column: position.character,
10491051
row: position.line,

0 commit comments

Comments
 (0)