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

C++ syntax settings selector not working properly #54

Closed
ghost opened this issue Dec 24, 2014 · 7 comments
Closed

C++ syntax settings selector not working properly #54

ghost opened this issue Dec 24, 2014 · 7 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Dec 24, 2014

I'm just getting ramped up with Atom and really liking it, however I'm having an issue with C++ syntax settings. I've added the following to my config:

'.c\\+\\+.source':
  'editor':
    'tabLength': 4

And it works just fine. However if I open the settings UI it modifies my config to this:

'.c ++ *.source':
  'editor':
    'tabLength': 4

This doesn't end up working; my C++ files now show up with my default 2 space tab size instead of my desired 4 spaces.

I've also noticed that if I use the system UI to modify the tab settings, it saves it as this:

'.c.source ++ *':
  'editor':
    'tabLength': 4

Which is not only a different format that other source selectors, but also still fails to be applied properly.

More odd is that after changing the setting in the UI to 4 and closing settings, when I reopen the settings, it still shows 2 for the tabLength.

I'm not sure how this is all wired up on the backend (haven't dug into code yet), but it definitely seems to be having issues. Perhaps if the issue is with the ++ it might be good to change the syntax scope to "cpp" instead, as it's a little simpler.

I'm using Atom 0.165.0 on OS X, installed just earlier today using the download button from https://atom.io. The Language C package is version 0.33.0. If you need any other details, please

@kevinsawicki
Copy link
Contributor

Thanks for reporting this, this is most likely a core bug where the config system is corrupting the selectors.

/cc @benogle @maxbrunsfeld

@maxbrunsfeld maxbrunsfeld self-assigned this Dec 24, 2014
@maxbrunsfeld
Copy link
Contributor

The problem might actually be in slick, the node module we use to parse CSS selectors:

selector = ".c\\+\\+.source"
selector = slick.parse(selector).toString() # => "*.c++.source"
selector = slick.parse(selector).toString() # => "*.c ++ *.source"

It removes the backslashes, which are needed the next time the selector is parsed.

@maxbrunsfeld
Copy link
Contributor

The simplest fix would probably be @nickgravelyn's idea:

it might be good to change the syntax scope to "cpp" instead

@kevinsawicki what do you think?

@kevinsawicki
Copy link
Contributor

Yeah, I'm all for changing it, the pluses were never a good idea to begin with and were just a leftover from converting the TextMate bundle.

The downside is breakage of any themes, snippets, etc. that are currently out there.

@lee-dohm
Copy link
Contributor

👍

@maxbrunsfeld
Copy link
Contributor

@nickgravelyn, this is fixed on master and will be in the next Atom release, v0.166. Thanks!

@ghost
Copy link
Author

ghost commented Dec 24, 2014

Awesome, thanks for the quick and decisive response. 👍

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