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

Troubles with first method in class #330

Closed
kud opened this issue Jun 2, 2017 · 3 comments
Closed

Troubles with first method in class #330

kud opened this issue Jun 2, 2017 · 3 comments

Comments

@kud
Copy link

kud commented Jun 2, 2017

image
image

It should be blue and not white.

Related: bloemert-group/oceanic-next-italic#25

test:

class Division extends React.Component {
  render() {
  }
}

export default Division
class Division extends React.Component {
  state = {}

  render() {
  }
}

export default Division
@ssangervasi
Copy link

I have encountered this problem with methods that are defined using the property-initializer syntax. I know this syntax is experimental, but it is very useful for automatically binding callbacks to a react component.

Here is an example that shows all the scopes that are applied to three different methods in a class:

class ClassWithBoundMethods {
  /**
   * Sublime scopes (fine):
   *  source.js
   *  meta.class.js
   *  meta.class-method.js
   *  string.unquoted.js
   *  entity.name.function.js
   */
  classMethod() {}

  /**
   * BROKEN Sublime scopes:
   *  source.js
   *  meta.class.js
   *  meta.class.property.js
   *  variable.other.property.js
   */
  firstBoundMethod = () => { return this; }

  /**
   * Sublime scopes (fine):
   *  source.js
   *  meta.class.js
   *  meta.class.property.js
   *  meta.function.arrow.js
   *  entity.name.function.js
   */
  secondBoundMethod = () => { return this; }
}

Note that firstBoundMethod and secondBoundMethod are identical except for the order in which they appear. They should be scoped the same, but are not.

Also interesting: if you add a semicolon anywhere between the two bound methods, then secondBoundMethod becomes broken as well.

@borela
Copy link

borela commented Jan 15, 2018

Try https://github.com/borela/naomi it supports classes, properties and even stage-0 features.

@Thom1729
Copy link
Contributor

This should be fixed in v10.0.0-beta.1. See #379 for more information on the new release. Please report any problems with v10 in a new issue.

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

No branches or pull requests

4 participants