5 ms·
MagicStack: Python syntax highlighter for Sublime Text and Atom
- cdnsteve 11y agoAre you looking for a hand on this project?
- 1st1 11y agoSure, feel free to create PRs and submit issues :)
- n0us 11y agoI was actually searching for something like this just the other week and couldn't find anything. This is great to see.
- 1st1 11y agoI'm one of the authors, ama.
- 0942v8653 11y agoDoes this allow highlighting function names in function calls? PythonImproved[0] does this (see lines 9 and 23 of [1]). [0]: https://github.com/MattDMo/PythonImproved https://github.com/MattDMo/PythonImproved [1]: https://packagecontrol.io/readmes/img/048b2068c7a455f3796334fb70127655a1f5f9cc.png https://packagecontrol.io/readmes/img/048b2068c7a455f3796334...
- 1st1 11y agoYeah, should be fairly easy to add. Please submit an issue!
- knite 11y agoCould you compare/contrast MagicStack with PythonImproved generally? Would love to know if MS is strictly better.
- 1st1 11y agoTry to add this snippet anywhere in your code: r'(' Besides broken regexps, PythonImproved still doesn't highlight async/await, highlights raw docstrings as regexps, incorrectly handles implicit line continuations in function parameter annotations, etc. Edit: here's an issue that documents some differences [1] [1] https://github.com/MagicStack/MagicPython/issues/3 https://github.com/MagicStack/MagicPython/issues/3
- knite 11y agoWhy is the issue closed and locked?
- 1st1 11y agoFixed in v0.4.21!
- dmishe 11y agoWhat are the advantages over built-in syntax highlight in sublime text?
- 1st1 11y agoTo name a few, we highlight correctly async/await, function annotations, very complex regexps, all kinds of unicode|byte|raw string literals (and new/old style formatting), docstrings, reserved words in improper contexts etc. Most importantly, MagicPython doesn't break where builtin sublime syntax fails, try this snippet for instance: def foo() -> int: return a
- dmishe 11y agoNoted, thanks
- jolux 11y agoA bit off topic, but what theme and color scheme are you using in your Sublime Text screenshot?
- 1st1 11y agoHere it is: [1] For now it has to be installed manually. I'll submit it to Package Control and create an Atom version soon. [1] https://github.com/MagicStack/Chromodynamics https://github.com/MagicStack/Chromodynamics
- peterhadlaw 11y agoIntermediate emacs user here. I really like the way Atom highlights Python code. With this I see it being even better. A question for the author: does this expand upon the capabilities of the editor or just provide a route for quicker updates that eventually could be mainlined? I've been thinking about scratching the itch to expand emacs Python highlighting to match that of Atom. From the looks of it, the code highlighting was primarily regex based, and the same from my cursory observations looking at emacs Python-mode syntax highlighting mechanisms. Could I incorporate this somehow into emacs from what I've said here so far? Also, thanks for helping out the community!
- 1st1 11y ago> [...] A question for the author: does this expand upon the capabilities of the editor [...] MagicPython is a completely new implementation, written from scratch. The ultimate goal would be to integrate it into Atom and Sublime Text by default (here's an issue I created for Atom for example [1]) > Could I incorporate this somehow into emacs from what I've said here so far? I'm not an emacs user myself, so I'm not sure. You can probably re-use some of the regexp tricks, and definitely our unit-tests. [1] https://github.com/atom/language-python/issues/109 https://github.com/atom/language-python/issues/109
- deleted 11y ago[deleted]
- thomasahle 11y agoLove the highlighting inside regular expressions. Much more useful than highlighting of the actual code.
- deleted 11y ago[deleted]
- BHSPitMonkey 11y agoIt looks like the name of this software is actually MagicPython, and MagicStack is the company who made it.
- personjerry 11y agoHow come it doesn't highlight "self"? I think that is an important enough keyword to be highlighted differently.
- llimllib 11y agopedantry, but probably relevant to the decision: self is not a keyword at all, it's a conventional choice. (I'd probably elect to highlight it, just saying that it's not a reserved word in any way.)
- mikepurvis 11y agoRather than highlight the specific string "self", instead highlight the first parameter of any non-static class method?
- 1st1 11y agoWell, if it's a decorated function, then one of the decorators might consume the first argument. IOW there is no reliable way to tell if the first argument of the method is really "self" or something else. In this very case its better to just stick to the conventional name.
- 1st1 11y agoIt's not a keyword in a classic sense, but yeah, we can assign it a distinctive scope. Feel free to open an issue!
- 1st1 11y agoThis has been fixed in the latest release!
- forgotpwtomain 11y agoWould love to see this ported for Geany.
- deleted 11y ago[deleted]