diff options
Diffstat (limited to 'src/webview/spellchecker.js')
-rw-r--r-- | src/webview/spellchecker.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js index f1bae1cd7..becaed449 100644 --- a/src/webview/spellchecker.js +++ b/src/webview/spellchecker.js | |||
@@ -4,7 +4,6 @@ import path from 'path'; | |||
4 | 4 | ||
5 | import { DICTIONARY_PATH } from '../config'; | 5 | import { DICTIONARY_PATH } from '../config'; |
6 | 6 | ||
7 | |||
8 | const debug = require('debug')('Franz:spellchecker'); | 7 | const debug = require('debug')('Franz:spellchecker'); |
9 | 8 | ||
10 | let provider; | 9 | let provider; |
@@ -15,6 +14,7 @@ async function loadDictionary(locale) { | |||
15 | try { | 14 | try { |
16 | const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`); | 15 | const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`); |
17 | await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`); | 16 | await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`); |
17 | debug('Loaded dictionary', locale, 'from', fileLocation); | ||
18 | } catch (err) { | 18 | } catch (err) { |
19 | console.error('Could not load dictionary', err); | 19 | console.error('Could not load dictionary', err); |
20 | } | 20 | } |
@@ -36,7 +36,9 @@ export async function switchDict(locale) { | |||
36 | return; | 36 | return; |
37 | } | 37 | } |
38 | 38 | ||
39 | provider.unloadDictionary(locale); | 39 | if (currentDict) { |
40 | provider.unloadDictionary(locale); | ||
41 | } | ||
40 | loadDictionary(locale); | 42 | loadDictionary(locale); |
41 | provider.switchDictionary(locale); | 43 | provider.switchDictionary(locale); |
42 | 44 | ||