-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat : Support for multiline statements #16
Conversation
src/repl.js
Outdated
const result = isRecoverableError(evaluateResult.exceptionDetails.exception, line); | ||
if (result) { | ||
this.io.setPrefix('...'); | ||
this.io.setMultiline(true); |
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.
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.
something a bit more "flowing" might be to return some symbol (IO.kNeedsAnotherLine
or something) from onLine
to tell the IO to buffer another line
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.
@devsnek Sure, will work on these things. I don't get your last statement though:
something a bit more "flowing" might be to return some symbol (IO.kNeedsAnotherLine or something) from onLine to tell the IO to buffer another line
@devsnek : Hey.. Have updated the PR with review comments fixed. Let me know if it's all good :) I played around and seems to be working fine: |
src/repl.js
Outdated
// lets try for recovering | ||
const result = isRecoverableError(evaluateResult.exceptionDetails.exception, line); | ||
if (result) { | ||
this.io.setPrefix('...'); |
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.
io should set the prefix when it receives $multiline. also the ...
needs a space after.
src/repl.js
Outdated
} else { | ||
// we tried our best - throw error | ||
// this.io.setMultiline(false); | ||
this.io.setPrefix('>'); |
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.
arrow should be reset by io when multiline ends. also the arrow needs a space after it.
@devsnek Thanks, I have done those changes locally, but somehow, I missed to push it. Now I guess it should be alright. Thanks for your time on this. |
ping @TimothyGu |
Just now realized my git username was wrong in commits; so just rewritten my commit message with right user name. |
src/util.js
Outdated
@@ -1,6 +1,7 @@ | |||
'use strict'; | |||
|
|||
const { isIdentifierStart, isIdentifierChar } = require('acorn'); | |||
const $multiLine = Symbol('IO.kNeedsAnotherLine'); |
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.
the symbols description should match where the symbol is mounted and under what variable name it is mounted. you should move it to io.js
file.
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.
Sure, will look into this.
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.
Shouldn't it be multiline
(lower and not camel which would suggest multi line
)?
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.
src/io.js
Outdated
@@ -1,6 +1,7 @@ | |||
'use strict'; | |||
|
|||
const { emitKeys, CSI, cursorTo } = require('./tty'); | |||
const multiline = Symbol('IO.kNeedsAnotherLine'); |
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.
please name the variable kNeedsAnotherLine
, and if it is supposed to be IO.kNeedsAnotherLine
, put it on the IO
object. (IO.kNeedsAnotherLine = Symbol('IO.kNeedsAnotherLine')
@devsnek Taken care, thanks. Let me know if anything needed from my side. |
@devsnek Any update on this? I'm waiting for your reply :) |
Hello,
Added the supported for multiline statements :#15
I have tested locally, it works.
Thoughts please?
Note: Recoverable.js is something I had taken from node core.