Giter Club home page Giter Club logo

Comments (5)

zertosh avatar zertosh commented on May 13, 2024

I'm confused on what it is exactly that you're asking for

from babel-sublime.

bathos avatar bathos commented on May 13, 2024

Sorry. This one is indeed a feature request, not a bug. I mean to say that it would be awesome if 'MyConstructor' in the following examples received a common scope like 'entity.name.constructor':

class MyConstructor {}

new MyConstructor()

MyConstructor

The second one already does get a targettable scope (entity.name.type.new) but the others don't. The last may be too opinionated, I don't know, but since the all-caps of MYCONSTANT is acknowledged as a naming convention that in itself is indicative of being a constant, it seems reasonable to me that this acknowledgement of naming conventions could be extended to MyConstructor (initial capital, followed by either all lowercase or mixed lowercase and uppercase).

from babel-sublime.

zertosh avatar zertosh commented on May 13, 2024

class MyConstructor {}

In this case, MyConstructor gets entity.name.class, which I think makes sense, since you're defining a class, not instantiating a constructor.

new MyConstructor()

Here, MyConstructor gets meta.instance.constructor, which I also think makes sense, for the opposite reason as above. You might not have noticed this, but if you try new ObjectBag.My.Constructor(), the entire name is still meta.instance.constructor - the periods are ignored.

MyConstructor

Heh yeah wayyy too opinionated. Consider that namespaces are often written with a capital too. Remember that the you can't get too specific with the naming because unlike syntax definitions (which are applied on a per-file basis), themes don't switch with file type. So, if your theme is too specific too one syntax, opening say an HTML file or Scala file, will look like crap.

Also, people have their opinions on self-instantiating constructor functions, but the fact is that ES6 classes can only be invoked with new as per the spec.

from babel-sublime.

bathos avatar bathos commented on May 13, 2024

Well awesome, I somehow missed entity.name.class for the first case! That's the one I thought was more important, but I was mistaken that it was absent.

I totally agree re: use of new. I'm not sure why acknowledging the naming convention is "wayyy" too opinionated ("regular" opinionated would do I think) since it's an even more commonly agreed on convention than CAPCONSTANT, but I agree it wouldn't be possible to differentiate between actual classes and objects-as-namespaces that share this naming convention so I understand the reasoning.

from babel-sublime.

zertosh avatar zertosh commented on May 13, 2024

heh I'm kidding with the extra "yyy". Even the DOM API follows "CAPCONSTANT", so I'd call that a defacto standard πŸ˜›

from babel-sublime.

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.