-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected indentation in Polymode #49
Comments
Is that the case? If I type your example and the first line If you look at the Lines 281 to 296 in 9740e40
the indentation level is calculated as just the nesting level in the parens. You could try to find the indentation level of the top-level line and add it as an offset to there. |
Ah, you're right
I'll have a look and report back. Is this something you'd like as a pull request? |
It'd be great yes! As long as top-level code is indented at level 0 by default, this seems like a nice extension to the current behavior. I don't see any downside with it 🙂 and looking at other modes, they all seem to behave this way as well. |
I work a lot in with ruby, where our tests have a lot of graphql queries written in HEREDOCs. I've written the following polymode definition to allow graphql-mode nested in ruby-mode:
which allows me to write the following in ruby:
As you can see the indentation works for all but the first and the last lines. For me the expectation would be that these lines are also indented and every indentation after is relative to this first indentation, like in this buffer that only has graphql-mode active (i.e. no polymode).
I was able to reproduce the error by defining a polymode for sh-mode, which also supports HEREDOCs
here's the result:
If this really is a graphql-mode issue, I'd be happy to take a look at the code, you just have to point me in the right direction.
Thank you in advance!
The text was updated successfully, but these errors were encountered: