Skip to content
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

Curly-braces indentation bug in editor #36

Closed
myisaak opened this issue Jan 13, 2019 · 2 comments
Closed

Curly-braces indentation bug in editor #36

myisaak opened this issue Jan 13, 2019 · 2 comments

Comments

@myisaak
Copy link

myisaak commented Jan 13, 2019

There is a particular annoyance when going through an interactive web tutorial which lies in the auto-indenting of your code -- and by auto-indenting I mean to avoid pressing TAB.

In your interactive Ruby tutorial, and playground this was the case. To reproduce this bug, take for example the following uncompleted ruby playground environment, note the use of -> to mark indents.

def main
->5.times {|i|
->->puts i
-># ...
end

When I add the second curly brace } after the third line puts i, what I expect is one indent like ->} but what I get is the following

def main
->5.times {|i|
->->puts i
->->} # unnecessary indent
end

There is an extra indent, or in other words, a missing or faulty auto formatting.
How exactly did you guys implement your indentation, I wouldn't mind submitting a pull request.

@easydatawarehousing
Copy link
Collaborator

Hi Isaak,

Thanks for reporting this issue. I've looked into this a little bit. The editor window uses a javascript library called codemirror. The minified and bundled version can be found in src/javascripts/vendor/codemirror-compressed-4.8.js. This version is quite old, current version is 5.42.
However the } de-indentation problem still seems to be present in the latest version (clone the codemirror repo, open mode/ruby/index.html). The keyword end is de-indented but } isn't.

Personally I'm not very eager to dive into codemirror code and fix this. But don't let that stop you :) I'm happy to update the vendored codemirror library.

Thanks,
Ivo

@myisaak
Copy link
Author

myisaak commented Aug 11, 2020

A pull request for codemirror that I created fixed this issue codemirror/codemirror5#5881 in version 5.51.0.

An update will be needed on codemirror from the current

/* CodeMirror - Minified & Bundled
to at least 5.51.0 to close this issue.

@myisaak myisaak closed this as completed Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants