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

Dollar should be part of identifiers #33

Open
PhiLhoSoft opened this issue May 4, 2016 · 7 comments
Open

Dollar should be part of identifiers #33

PhiLhoSoft opened this issue May 4, 2016 · 7 comments
Labels

Comments

@PhiLhoSoft
Copy link

I opened a similar issue for JavaScript: atom/language-javascript#374

Frankly, I dont use Atom to edit Java code, I use Eclipse instead. Given the low number of issues here, either I am not alone, or you are very good... 😛

OK, let's repeat the gist of the previous issue:

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

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.
  • If an identifier has a $ in its middle, the part after the $ is highlighted differently.

I know that Sun recommended not to use $ in identifiers, keeping this usage for themselves, but yet it is a valid char, and should be treated as such.

@noseglid
Copy link
Contributor

Variables with $ is correctly highlighted now.

Correct me if I'm wrong, but I don't think the "double-click" or ctrl-left to jump words is managed by the languages. @50Wliu ?
If not than this can be closed.

@PhiLhoSoft
Copy link
Author

PhiLhoSoft commented Jun 28, 2016

Correct me if I'm wrong, but I don't think the "double-click" or ctrl-left to jump words is managed by the languages

If not, it is a problem (with Atom itself) / they should be: these operations are based on the concept of "words", and this concept is tightly related to the language: $ is a good example here (valid in JS / Java, not in some other languages), but in other languages (CSS for example) dash is also part of identifiers (words), and so on. Idem for Unicode characters.

@noseglid
Copy link
Contributor

@PhiLhoSoft I totally agree. It should be part of the language definition. But as it is now, the rest of this issue (aside from highlighting) does not belong to this repo (if that is so).

In CSS, stuff like dashes in e.g. border-top behave the same way as how you're describing $ in java.

@PhiLhoSoft
Copy link
Author

That's annoying, but indeed, if that's beyond your scope, please feel free to close the issue if you fixed what was within your reach.

@winstliu
Copy link
Contributor

winstliu commented Jul 15, 2016

Correct me if I'm wrong, but I don't think the "double-click" or ctrl-left to jump words is managed by the languages. @50Wliu ?

It actually is. editor.nonWordCharacters can be modified by languages (and I have a local branch changing that). I think the Find and Replace "whole word" regex can't be changed though.

@noseglid
Copy link
Contributor

Cool, thanks for the correction!

@PhiLhoSoft
Copy link
Author

I haven't understood the comment of @50Wliu until today, thanks to the comment atom/language-javascript#374 (comment)
So, we can at least fix that ourselves. Might be nice to be the default, though.

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

No branches or pull requests

3 participants