Giter Site home page Giter Site logo

Comments (5)

romainl avatar romainl commented on June 14, 2024

I tried to prevent named things to be tagged twice or more.

const foo = 1;
export default foo;

foo is already taken care of by another rule so I don't need it to be tagged a second time.

In the examples given on MDN:

export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };

the only case that would warrant tagging would be the third one but I'm not sure how common it is. The others are not named so they are not interesting.

from ctags-patterns-for-javascript.

alexlafroscia avatar alexlafroscia commented on June 14, 2024

Yeah, that makes sense. However, there is the use case where the default export has no other name.

For example, there's no reason a module can't just do

export default 1;

That doesn't actually make sense, but this pattern is really common with Ember applications where you export a Controller or Route

import Controller from '@ember/controller';

export default Controller.extend({
  // ... stuff
});

Unfortunately they're not "real" classes so the normal Class tagging doesn't help at all.

from ctags-patterns-for-javascript.

romainl avatar romainl commented on June 14, 2024

Point taken. If you feel like writing basic regexp you are welcome to send a PR otherwise I'll probably tackle the problem this week-end.

from ctags-patterns-for-javascript.

alexlafroscia avatar alexlafroscia commented on June 14, 2024

No rush. I also totally understand your reasoning and if you're not interesting in supporting it, that's fine too. Eventually Ember will get ES6 classes and this particular use-case will go away, but in the meantime it's hard to use CTags with an Ember project, even with these improvements.

from ctags-patterns-for-javascript.

romainl avatar romainl commented on June 14, 2024

@sukima's PR seems to fix this for good.

from ctags-patterns-for-javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.