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

accept multi-byte comment when run code #4

Merged
merged 2 commits into from
Nov 19, 2019
Merged

accept multi-byte comment when run code #4

merged 2 commits into from
Nov 19, 2019

Conversation

mogimogitomato
Copy link
Contributor

Add utf-8 encoding when sending code to sonic-pi.

@mogimogitomato mogimogitomato changed the title accept multi-byte comment when run code WIP: accept multi-byte comment when run code Nov 19, 2019
@mogimogitomato mogimogitomato changed the title WIP: accept multi-byte comment when run code accept multi-byte comment when run code Nov 19, 2019
Copy link
Owner

@mactkg mactkg left a 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');
Copy link
Owner

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?

Copy link
Contributor Author

@mogimogitomato mogimogitomato Nov 19, 2019

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';
Copy link
Owner

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?

Copy link
Contributor Author

@mogimogitomato mogimogitomato Nov 19, 2019

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
Copy link
Owner

@mactkg mactkg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Thanks!

@mactkg mactkg merged commit 8c79920 into mactkg:master Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants