Skip to content

Commit

Permalink
Merge pull request #3 from hannut91/fix-encoding-bug
Browse files Browse the repository at this point in the history
Fix URI Encoding bug
  • Loading branch information
hannut91 committed Oct 30, 2019
2 parents 11fd863 + e16ab14 commit 38b55f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "korean-spell-checker-vs-code",
"displayName": "Korean Spell Checker VS Code",
"description": "",
"version": "0.2.2",
"version": "0.2.3",
"engines": {
"vscode": "^1.38.0"
},
Expand Down
9 changes: 5 additions & 4 deletions src/commands/spell-check.ts
Expand Up @@ -3,10 +3,11 @@ import { window, ViewColumn } from 'vscode';
import { SpellCheck } from '../services/spell-checker';

const STYLE = `<style>
.red_text { color: red; }
.green_text { color: green; }
.blue_text { color: blue; }
.violet_text { color: purple; }
.red_text { color: #f44336; }
.green_text { color: #4caf50; }
.blue_text { color: #2196f3; }
.violet_text { color: #9c27b0; }
body { padding: 16px; font-size: 15px; line-height: 22px;}
</style>`;

let panel: any;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/spell-fix.ts
Expand Up @@ -12,15 +12,15 @@ const getText = curry((textline: TextLine, selection: Selection) => {
const { lineNumber } = textline;
if (lineNumber === selection.start.line) {
return new Range(
selection.start, textline.rangeIncludingLineBreak.end)
selection.start, textline.rangeIncludingLineBreak.end);
}

if (lineNumber === selection.end.line) {
return new Range(textline.range.start, selection.end);
}

return textline.rangeIncludingLineBreak;
})
});

export const spellFix = async () => {
const editor = window.activeTextEditor;
Expand Down
2 changes: 1 addition & 1 deletion src/services/spell-checker.ts
Expand Up @@ -6,7 +6,7 @@ const MAX_TEXT_COUNT = 500;

export const SpellCheck = async (text: string): Promise<any> => {
const { data } = await axios.get(
encodeURI(URL + text.slice(0, MAX_TEXT_COUNT))
URL + encodeURIComponent(text.slice(0, MAX_TEXT_COUNT))
);
return data.message.result;
};

0 comments on commit 38b55f1

Please sign in to comment.