Skip to content

Commit

Permalink
Get accurate symbols for C language
Browse files Browse the repository at this point in the history
Exclude all non-alphanumeric chars for C files
getCurrentWordBufferRange returns the range of the whole word
including all punctuation marks when the word is pre-selected.
With a precise regular expression this can be avoided.

Signed-off-by: Jinkyu Song <[email protected]>
  • Loading branch information
Jinkyu Song committed May 27, 2015
1 parent be3b6f6 commit af17c2e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/file-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class FileView extends SymbolsView
if cursor.getScopes().indexOf('source.ruby') isnt -1
# Include ! and ? in word regular expression for ruby files
range = cursor.getCurrentWordBufferRange(wordRegex: /[\w!?]*/g)
else if cursor.getScopes().indexOf('source.c') isnt -1 or
cursor.getScopes().indexOf('source.cpp') isnt -1
# Exclude all non-alphanumeric chars in word regular expression for C files
range = cursor.getCurrentWordBufferRange(wordRegex: /[\w]*/g)
else
range = cursor.getCurrentWordBufferRange()
return editor.getTextInRange(range)
Expand Down

0 comments on commit af17c2e

Please sign in to comment.