-
Notifications
You must be signed in to change notification settings - Fork 93
Add a SMIE rule function for "def". Fixes #38. #48
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
Merged
mattdeboard
merged 13 commits into
elixir-editors:master
from
mattdeboard:fix-use-indentation
Jul 5, 2014
Merged
Add a SMIE rule function for "def". Fixes #38. #48
mattdeboard
merged 13 commits into
elixir-editors:master
from
mattdeboard:fix-use-indentation
Jul 5, 2014
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes #41 |
This was referenced Jun 22, 2014
👍 fixed my indentation issues. Thanks! |
Great |
`indents-last-commented-line' was passing unexpectedly. The example in the test differs from the example given by elixir-editors#27. The latter does cause the expected failure in the test.
This function now explicitly sets the indentation level of lines beginning with "def" to 2. Formerly, this token returned `nil` (the default, because there was no matching pattern in `elixir-smie-rules`), which caused SMIE to call `smie-indent-after-keyword` to calculate the indentation. This function was returning the incorrect value which was causing the inappropriate alignment to the `.`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This function now explicitly sets the indentation level of lines beginning with "def" to 2. Formerly, this token returned
nil
(the default, because there was no matching pattern inelixir-smie-rules
), which caused SMIE to callsmie-indent-after-keyword
to calculate the indentation. This function was returning the incorrect value which was causing the inappropriate alignment to the.
.I have been working on this for quite a long time, many months. I was very undisciplined about staying focused on just #38. I hate big kludgy pull requests, but due to the fact I had to learn more about BNF grammars & emacs lisp than I ever thought I would this bug fix took on a life of its own. Half out of necessity.
In addition to fixing that, this PR also:
Straightens out all tests. If a feature is broken in elixir-mode, and the test fails because of that test, I marked it as an expected failure. I added a comment to the top of the indentation tests module explaining my intent. This made running the tests far less confusing. Instead of a mix of "supposed to pass and does", "supposed to fail and does", "supposed to pass but fails", and "supposed to fail but passes", now only the first two categories exist.
Broke up very long lines into <=79 columns, as much as I could. When learning how all this code works, readability was very important. Usually this meant breaking up compound conditionals and so forth into a line-per-condition.
Fixed an issue with syntax highlighting for lines like:
Previously, the
.Bar
did not get colored correctly. Now it does.This one is probably the sloppiest transgression: I put @tomterl's fix for Avoid indentation errors after 'end'. #41 in here as well, and added tests to boot. This is the only one where I threw in a bug fix for its own sake. Sorry.
Fixed a deprecated keyword, changing
function
todef
here. This was done while I was trying to get all the tests to get to a predictable state. A bug fix, but strictly in the interest of getting tests to pass with correct Elixir code in the test case.There is a lot of change in here. Please let me know what I can do to help move the ball forward on this PR.
Thanks
Matt