Skip to content
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

Export Class Support #8

Open
evanleck opened this issue Apr 22, 2018 · 8 comments
Open

Export Class Support #8

evanleck opened this issue Apr 22, 2018 · 8 comments

Comments

@evanleck
Copy link

I'm pretty unfamiliar with the syntax for ctags regex and was wondering if there's a reason that the following wouldn't work?

export class Foo {
  // ...
}

I'd expect to be able to reach Foo as a class if that makes sense.

@romainl
Copy link
Owner

romainl commented Apr 22, 2018

The pattern for the Class kind assumes this structure:

[BOL][0+ whitespace][class][1+ whitespace][name]

You would need to add another pattern for that one:

[BOL][0+ whitespace][export][1+ whitespace][class][1+ whitespace][name]

But I'm conflicted about this request as Foo would be both a named export and a class.

@evanleck
Copy link
Author

Hm, yeah I see get the conflict. Is that just a semantic difference in ctags or is it more meaningful?

@evanleck
Copy link
Author

For the pattern, would this make sense?

--regex-javascript=/^[ \t]export[ \t]*class[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/C,Class,Classes/b

I just added export[ \t] in front of *class...

@romainl
Copy link
Owner

romainl commented Apr 23, 2018

This is better:

--regex-javascript=/^[ \t]*export[ \t]\{1,\}class[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/C,Class,Classes/b

This is not a technical problem, really, but a semantic problem: is that a named export or class definition?

@evanleck
Copy link
Author

Makes sense, thanks! And it’s really both. I have a single file with a single class definition that it exports as a named export (i.e. not the default export).

@tom3q
Copy link

tom3q commented Sep 6, 2019

Hey Romain, thanks a lot for creating this super useful setup! I stumbled across the same problem. Do you think it would be possible to add the regex from your comment above to the repository?

@romainl
Copy link
Owner

romainl commented Sep 6, 2019

@tom3q I'm still not sure how to classify that thing: "class definition" or "named export", as it's both and I have no desire to have dupes in the generated tags file. Either way, you could add it to your own fork in the mean time.

@tom3q
Copy link

tom3q commented Sep 8, 2019

Okay, thanks for explanation. I'll keep it in my fork.

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

No branches or pull requests

3 participants