Skip to content

Enhance regex to recognize variables #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

igorlima
Copy link

@igorlima igorlima commented Jul 18, 2020

It looks like when assigning another variable to another it's not being recognised by ctags. Also when any string is set by back-tick, or set by string template, it's not being recognised too.

Given the js file below

const year = 1984
const month = `october`
const day = '21'
const birthday = year + 'y' + month + 'm' + day + 'd'

we can use the command bellow to test it out:

ctags  -f - --format=2 --excmd=pattern --fields=nks <filename>

BEFORE

As it is today, we have the following output from ctags

day	test-test.js	/^const day = '21'$/;"	V	line:3
year	test-test.js	/^const year = 1984$/;"	V	line:1

AFTER

After applying this enhancement, we start getting the following output

birthday	test-test.js	/^const birthday = year + 'y' + month + 'm' + day + 'd'$/;"	V	line:4
day	test-test.js	/^const day = '21'$/;"	V	line:3
month	test-test.js	/^const month = `october`$/;"	V	line:2
year	test-test.js	/^const year = 1984$/;"	V	line:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant