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

Dollar should be part of identifiers #374

Open

Description

@PhiLhoSoft

Atom 1.7.3, Windows 7, although the latter is probably not relevant...

I searched for "dollar" and found no relevant issue, which is surprising... Actually, I am not sure if my issue should be here or in atom/atom (started to write there, made my mind to post here).

AFAIK, $ is part of the valid characters in identifiers, like underscore. Yet it is treated as a foreign punctuation character in many features of Atom.
Examples:

  • Double click to select the identifier: the $ isn't selected (if prefix or suffix) or stops the selection (in the middle).
  • Word move with Ctrl+Left / Right arrow: stops on $
  • Search log with Whole Word option: selects the log part of $log.

And probably more...

Really annoying, particularly when you code in AngularJS... (many Angular identifiers start with $).

Side note: same problem in Java, except they add insult to injury by highlighting differently the part of the identifier after $... Will open a separate issue, of course.

Activity

  1. winstliu commented on May 4, 2016

    @winstliu
    Contributor

    This is a duplicate of #344 - feel free to subscribe there for updates.

  2. PhiLhoSoft commented on May 5, 2016

    @PhiLhoSoft
    Author

    I don't perceive this issue (which seems very narrow) to be a duplicate.
    My report isn't about syntax highlighting (or not only), but also about selection behavior and similar things.
    Now, if you fix all issues at once, that's fine then.

  3. winstliu commented on May 6, 2016

    @winstliu
    Contributor

    My apologies - I didn't read the issue closely enough 😥.

  4. Alhadis commented on Aug 23, 2016

    @Alhadis
    Contributor

    @PhiLhoSoft Try removing $ from your editor's Non-word characters setting:

    Figure-1

  5. PhiLhoSoft commented on Aug 26, 2016

    @PhiLhoSoft
    Author

    @Alhadis Ah, good idea, but then again, the big problem of this setting is that it is global to Atom, which makes it kind of useless.
    Lot of languages might not accept $ in the identifiers...
    And if I want to include - in CSS identifiers (where they are common), it might bring havoc in other source codes not putting spaces around this operator...

  6. Alhadis commented on Aug 26, 2016

    @Alhadis
    Contributor

    Then you scope the change to be language-specific. In your user config file:

    ".js.source":
      editor:
        nonWordCharacters: "/\\()\"':,.;<>~!@#%^&*|+=[]{}`?-…"
  7. PhiLhoSoft commented on Aug 26, 2016

    @PhiLhoSoft
    Author

    Wow, it works! Great solution, I forgot or didn't know about these language specific settings.
    http://flight-manual.atom.io/using-atom/sections/basic-customization/
    For the record, at the end of config.cson, I added:

    ".js.source":
      editor:
        nonWordCharacters: "/\\()\"':,.;<>~!@#%^&*|+=[]{}`?-…"
    ".html.text":
      editor:
        nonWordCharacters: "/\\()\"':,.;<>~!@#%^&$*|+=[]{}`?…"
    ".stylus.source":
      editor:
        nonWordCharacters: "/\\()\"':,.;<>~!#%^&*|+=[]{}`?…"
    

    And now I have a more consistent editing experience... 😁

  8. Alhadis commented on Aug 26, 2016

    @Alhadis
    Contributor

    Don't you just love this program?!

  9. PhiLhoSoft commented on Aug 26, 2016

    @PhiLhoSoft
    Author

    I will leave this issue opened, as it is a (good) workaround, but it forces each user to do it (when they know the trick).
    Perhaps each language plugin should (be able to) set this setting by default.

    And, but this is more an issue to open on core Atom, Find whole word doesn't take this setting in account. 😞

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions