-
Notifications
You must be signed in to change notification settings - Fork 10
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
accept multi-byte comment when run code #4
accept multi-byte comment when run code #4
Conversation
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.
Thank you for your contribution!
I reviewed your code. Please reply my comments.
src/extension.ts
Outdated
@@ -53,7 +54,8 @@ class SonicPi { | |||
if(!editor) { | |||
return; | |||
} | |||
return editor.document.getText(); | |||
const iconv = require('iconv-lite'); |
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 think that we can import iconv-lite
at top of this file. Do you have any reason to require the library here?
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.
Sorry, I should modify getCurrentCode()
type definition String to Buffer.
but I tried to tsc without modify, called require, not import.
It's wrong, so I fixed mistakes.
src/type.d.ts
Outdated
@@ -0,0 +1,2 @@ | |||
declare module 'osc-js'; | |||
declare module 'iconv-lite'; |
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 found index.d.ts
file for iconv-lite
: https://github.com/ashtuchkin/iconv-lite/blob/17d00ab8cd663acafe390d8224ca1d44cb0b2085/lib/index.d.ts
Should we declare iconv-lite
?
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.
You're right, there're no need to declare iconv-lite
.
I restore modification.
mod method's return type restore declaration change mod iconv's require to import
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.
Approved. Thanks!
Add utf-8 encoding when sending code to sonic-pi.