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
JavaScript: Ignoring certain tag patterns for JS #1680
Comments
There is no way to do so in ctags. grep may help you to strip unwanted items like:
I don't know node js well, so I wonder why you don't want to skip the |
I want to skip them because when i use go to definition in vim, it goes to the file where i imported that tag, instead of going to that tag directly. |
@kristijanhusak not a direct solution, but Node supports standard JS import mechanism, maybe that will be handled better by ctags? |
I understand what you wrote as follows: In javascript language level, CustomerValidator is defined two twice. Am I correct? If your answer is yes, I would like to know custom_validator side. In Javascript level, there is no solution for your trouble. The code However, u-ctags supports sub-languages on language. I wonder I can do something interesting for nodejs input. |
@codebrainz if you are talking about @masatake It's more than once, everywhere where i required it.
The main problem is that customer_validator.js itself doesn't have a proper definition where tags can be generated. This is the contents of the customer_validator.js const Joi = require('../validation/joi');
const Validator = require('../validation/basic_validator');
const createSchema = Joi.object().keys({
phone: Joi.string().phone().optional().allow(''),
email: Joi.string().email().optional().allow(''),
});
module.exports = {
validateCreate: data => Validator.validate(data, createSchema),
}; When i do something like this in customer_validator.js, the tag line for it gets generated: // ..
const CustomerValidator = {
validateCreate: data => Validator.validate(data, createSchema),
};
module.exports = CustomerValidator; In tags i get:
I understand why the tag cannot be generated for this concrete file, but i would like to avoid having bad tags even if i don't have the right one. |
I wrote long reply in English. Though I mistakenly close the page before submitting it.
ctags capatures CustomerValidator from customer_validator.js as an extra tag. Tell that tags of nodejs higher priority than JavaScript to your enough smart editor or file viewer, you can go directly to customer_validator.js. It is up to your tool:-P. |
translator or translte is bad name. I think I should call it transformer. You can define your own transformers in C. You can apply them to a string pick updated by regex pattern. If I found enough supporters of this idea, I will finish the patch. |
I should use |
That would be awesome! I have a lot of files that are like that, and i don't have a proper tag definition. If it is, we should maybe limit creating these only for these situation where we don't have a proper tag definition in a file, like this If this gets added, i believe it should be optional, since some people probably don't want this to happen by default. |
It does NOT generating the underscore tags for all input files. Generating tags only for matching specified pattern. The change comes from two parts. One is written in C and the other is written in ctags option file. What I would like to see is ctags option part. It does many things. The C part I wrote must be added to ctags itself, of course. However, the .ctags optoin file part should be given by user, as you wrote as "optional". I will wait for more comment from another person. |
Ok, thanks. Looking forward to it. |
The question on the page is very related to what we discussed here. |
It might be better to name the option after CommonJS or RequireJS or whichever library provides this pattern/convention rather than making it Node-specific. Later similar hacks could also be added for the competing module systems. This might make more sense than naming the option after Node which is just bog standard JS. |
@codebrainz, sure, I should not use "nodejs" as language name. I thinks the pattern and language should be defined by users. My proposal is the notation {input} in --regex- option. |
I will make a pull request. |
A new prototype works. I wrote a very small virtual machine for transforming names. In the protoype, I introduce following notation in
With the new notatin, what you want can be written:
https://en.wikipedia.org/wiki/Camel_case
|
As I wrote in the last comment I planed to introduce a shell like language that uses shell style:
ps style
Not so different at a glance. |
Any updates on this issue? |
This sounds exactly what I'm looking for and I hope we can get it merged. I'm working on a AngularJS project where the convention for all class definitions are defined as anonymous class exports. Given a file named hello-world.controller.js export default class {
...
} The tag for this would be HelloWorldController |
Along these same lines, I don’t think ES6 modules are being supported. The syntax for them is |
I assume there is already a way to do this, i just wasn't able to figure it out.
I'm using ctags on a node js project, which uses node module structure with require()/module.exports.
I would like to skip generating tags for constants that contain the require() in them.
For example, this is line in ctags that i would like to skip generating:
I know i could skip generating
C
kind, but i would still love to leave that for other things.Thanks!
The text was updated successfully, but these errors were encountered: