Conversation
|
As pointed out in the #68 There's a work that should've have these fixes already implemented... no Idea why a PR hasn't been opened (or has it been opened and then rejected)? https://github.com/MatthewNewland/language-python3 I tried to have a look at it, but it tries to have 2 parallel grammars for Python and Python2, and it's not quick to understand the intention behind the changes |
|
I just realized (I was sleepy when I wrote this PR, and I probably only cared for the simplest case) that, it'd need to handle arbitrary expressions in the annotations, so if someone wants to build upon this, please keep it in mind. Basically, the following is valid Python code: def f(a: lambda: 1) -> lambda: 1: passI guess this might be easier to do if |
|
Isn't this a duplicate of #88? |
|
Any update on this? Trying to view Python sources on GitHub with this bug still there is starting to make my eyes die. |
|
@thomasjo I know: I wrote
The problem is with the scope names, and for that reason we'd need some documentation on how they are put together... maybe someone more familiar with Atom can point out where to look? |
Problem is that there currently is no real guidance or documentation for this. Atom simply inherited grammars from TextMate. There is some level of standardization, but not uniformly so. A start is https://manual.macromates.com/en/language_grammars.html#naming_conventions. A little while ago @MaximSokolov started an issue regarding the lack of a proper naming standard: atom/atom#8430. You might want to check that out as well for some guidance. For now, the best bet is to follow the TextMate guidelines, and asking for feedback on your proposed scope names. /cc @atom/feedback |
|
Thank you I had another look at the error that I got: a I guess I could try to ask on freenode #atom? |
spec/python-spec.coffee
Outdated
There was a problem hiding this comment.
f is just entity.name.function. Remove 'support.function.magic.python'
There was a problem hiding this comment.
Ahh, gotcha.... __init__ is parsed as a 'support.function.magic.python'
It was unexpected for me that it'd be tokenized differently
Thank you
|
Forgive me for the ignorance, but does this work with more complex function annotations like |
|
I won't have time to work on this very soon, if you want to have a stab at it please don't wait for me :) |
spec/python-spec.coffee
Outdated
There was a problem hiding this comment.
Python uses punctuation.separator.valuepair.dictionary for : inside dictionaries. So scope here should be punctuation.separator.valuepair
There was a problem hiding this comment.
uhm, but this is inside a definition...
we can go with punctuation.separator obviously, no strong opinion either way and not sure which one would work out better
There was a problem hiding this comment.
The point is : separates key from value (a is a key, int is a value. Correct me if I am wrong)
There was a problem hiding this comment.
True, but this is not a dictionary... this is more like a triple than a pair:
def f(a:int=1): pass
a is the key, and both 1 and int are the associated values.
For tokenizing purposes, this might be splitting hairs... I'm more concerned with the fact that information about being "inside a definition" might be lost.
If punctuation.separator.valuepair would lead to better syntax highlighting I'll surely pick that
There was a problem hiding this comment.
I'm more concerned with the fact that information about being "inside a definition" might be lost.
Do you mean inside a function definition? meta.function already append this information.
There was a problem hiding this comment.
fair enough, I don't have any more doubts
|
I got a non-solution: I stopped using |
|
@berdario thanks for this. I would replace this package with magicpython. It's so much better. |
This thing is not quite working
I get a new
support.function.magic.pythonapparently from nowhereIf someone can fix this and complete the PR for me that'd be nice, or also explain how the scopes names are pulled together
I tried to have a look at this, but it doesn't to deal with technical stuff