Skip to content

Commit 93c24fe

Browse files
authored
Fix quoted idents in ctags (#24317)
Running `ctags` on files with quoted symbols (e.g. `$`) would list \` instead of the full ident. Issue was the result getting reassigned at the end to a \` instead of appending
1 parent ae9287c commit 93c24fe

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

compiler/docgen.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ proc getName(n: PNode): string =
830830
of nkAccQuoted:
831831
result = "`"
832832
for i in 0..<n.len: result.add(getName(n[i]))
833-
result = "`"
833+
result.add('`')
834834
of nkOpenSymChoice, nkClosedSymChoice, nkOpenSym:
835835
result = getName(n[0])
836836
else:

tests/tools/tctags.nim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
discard """
2+
cmd: '''nim ctags --stdout $file'''
3+
nimout: '''
4+
Foo
5+
hello
6+
`$$`
7+
'''
8+
action: "compile"
9+
"""
10+
11+
type
12+
Foo = object
13+
14+
proc hello() = discard
15+
16+
proc `$`(x: Foo): string = "foo"

0 commit comments

Comments
 (0)