Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add support for properties and relax support.function regex #217

Closed
wants to merge 1 commit into from

Conversation

winstliu
Copy link
Contributor

🚨 ⚠️ Do not merge yet! Specs on atom/atom also need to be updated! ⚠️ 🚨

This PR replaces #210, brings back #158, and combines it with #146.

  • support.function.dom.js has been kept and is prioritized over the now-generalized support.function.js regex.
  • entity.name.property.js now catches anything that doesn't fall into support.constant{.dom}.js and support.class.js

Before:
before

After:
after

/cc @bucaran since I know you had some concerns about this
/cc @nevir because this only adds .property for things not already marked as .class and .constant
/cc @Victorystick, @AMalininHere, @pchaigno

Refs #137
Fixes #37
Closes #146

@MaximSokolov
Copy link
Contributor

support — things provided by a framework or library should be below support.

  • function — functions provided by the framework/library.
hello.prop.anotherProp.notAProp().yesProp.window;

Why you use support.function for 'notAProp'? 'notAProp' would be support.function only if 'hello' is a support.class or support.type (I assume that we don't known is 'notAProp' a library function) I don't think it's a good idea to usesupport.function for all methods. IMO for method calls it can be:

hello.wow(arg1, arg2)

'wow(arg1, arg2)' — meta.method-call

  • 'wow' — entity.name.function
  • '(' — punctuation.definition.arguments.begin
  • 'arg1', 'arg2' — variable.other.argument
  • ',' — punctuation.separator.arguments
  • ')' — punctuation.definition.arguments.end

I wraped 'wow(arg1, arg2)' with meta.method-call because I don't think 'wow' should be the same color as 'wow' in function declaration. So it will be possible to change color for 'wow' with styles for
meta.method-call -> entity.name.function

entity — an entity refers to a larger part of the document

  • name — we are naming the larger entity.
    • function — the name of a function.
    • type — the name of a type declaration or class.
    • tag — a tag name.
    • section — the name is the name of a section/heading.

Also I am not sure about entity.name for properties. Shoud it be the same color as class/funciton name since property isn't always a class or a function:

a.prop = 2

variable.other.property maybe?

@winstliu
Copy link
Contributor Author

What would you suggest notAProp() to be then?

@MaximSokolov
Copy link
Contributor

I wrote about it above:
meta.method-call for 'notAProp()' and entity.name.function for 'notAProp' (like in functions declarations with meta.function)
Same for functions calls

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

Successfully merging this pull request may close these issues.

2 participants