-
Notifications
You must be signed in to change notification settings - Fork 31
Matlab syntax and Comment blocks for Matlab and Julia #144
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
base: master
Are you sure you want to change the base?
Conversation
when running through a file using "ctrl+enter" don't send empty lines. In essence ignores "cmd" of zero length and also doesn't send "code" of zero length.
Matlab syntax - Expands all blocks that can be terminated with "end" Matches also "function" to "end" for compatibility with octave Uses array matching from Julia Keeps matching for "import" in comparison to Julia as does not have the others (haven't used it personally but according to documentation should work correctly) Comment blocks - Expands comment blocks for both Matlab and Julia Fake blocks (Julia and Matlab) - "fake blocks" which match around code you want to send all at once (speeds up debugging ). Deficiencies - matches Matlab comment blocks even if there is more text after %{ even though I added "\s*$" (r"\s*%{\s*$", thiscmd). Maybe .re library differs from the regex checking tool I was using. Feature suggestions/plans - Expanding blocks around array when sending it while on it's last line: A = [ 1 2 4 3 ]; ["enter"] Sending only #==# for Julie and %{%} of matlab comment blocks option (de-cluttering your console write-out ) Update getter.py
Thanks for the contribution, I will take a closer look tonight. |
Edit: oh, there was an example above. |
code_getter/getter.py
Outdated
s = sublime.Region(s.begin(), view.line(endline.end()).end()) | ||
|
||
elif re.match(r".*].*$", thiscmd) and not re.match(r".*\[.*$", thiscmd): | ||
s = self.backward_sq_bracket_expand(s, pattern=r"[\[](?=\s*)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not very accurate. Imagine we have a string s = "]"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sry didn't realise it would be updating the pull as I make changes to my repository. The square bracket is a work in progress from today.
What is the correct way to do these pull requests? Creating a separate branch for each pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. It is usually a better idea to create a new branch for pull requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But at least in matlab there are no other uses for square brackets than array definitions so solving the issue you raised should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I argue that we shouldn’t allow this though. The code is not readable with that style and you should first run a code formatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matlab syntax -
Expands all blocks that can be terminated with "end"
Matches also "function" to "end" for compatibility with octave
Uses array matching from Julia
Keeps matching for "import" in comparison to Julia as does not have the others (haven't used it personally but according to documentation should work correctly)
Comment blocks -
Expands comment blocks for both Matlab and Julia
Fake blocks (Julia and Matlab) -
"fake blocks" which match around code you want to send all at once (speeds up debugging by the means of interpreting line by line).
Deficiencies -
matches Matlab comment blocks even if there is more text after %{ even though I added "\s*$" (r"\s*%{\s*$", thiscmd). Maybe .re library differs from the regex checking tool I was using.
Feature suggestions/plans -
Expanding blocks around array when sending it while on it's last line:
A = [ 1 2
4 3 ]; ["enter"]
Sending only #==# for Julie and %{%} of matlab comment blocks option (de-cluttering your console write-out )
Really loving the package, hope you will find some of the features worth adding.