billymoon / Stylus

Stylus Package for Sublime Text 2 / 3
Other
129 stars 31 forks source link

Cmd+Return behaves unexpectedly (w/o semicolons) #72

Closed agarzola closed 8 years ago

agarzola commented 8 years ago

Using Sublime Text 2, Cmd+Shift+Return from anywhere on a line works as expected: it enters a new line just above the current line, indented at the current line’s level. But when I use Cmd+Return from anywhere on a line, I get this:

This only happens when the line from which the keystroke is used does not have a semicolon at the end. When a semicolon is present, the same command behaves as expected. See this GIF for an illustration of the problem.

GIF illustrating the problem

What I expect from Cmd+Return is the opposite of Cmd+Shift+Return: it enters a new line just below the current line, indented at the current line’s level.

grassator commented 8 years ago

Hi, thank you for the report, I will try to look into that, but can't promise quick fix.

agarzola commented 8 years ago

No worries. Thank you for the prompt reply!

I tried to look into it, but don’t know my way around Python. If you point me in the right direction, though, I’d be happy to look into it and submit a PR if I find a solution.

grassator commented 8 years ago

Let me start by saying, that I'm not sure how to fix this without experimenting. The original problem is that Sublime syntax are not powerful enough to correctly handle indentation-based language like Stylus, especially because in Stylus almost everything that you write could be a variable and code blocks don't differ from rules much from the grammar standpoint.

Despite that I still wanted to provide auto-indentation for the cases that was possible to recognise by inspecting current line. This is what this code is for, and any fixes will probably be around there, but it also might be completely unfixable, depending on how Sublime handles these commands.

agarzola commented 8 years ago

In case anybody finds themselves experiencing this issue, I found that it stemmed from a keybinding defined inside Hayaku, which I had apparently installed at some point. ¯_(ツ)_/¯