aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* make formatFlorian Fischer2021-12-281-2/+3
|
* [Readme] update Readme to reflect the file language changesFlorian Fischer2021-10-071-3/+3
|
* Add 'spelllang' command to print the current valueFrank Seifferth2021-10-071-0/+6
| | | | | To me, this seems pretty useful for debugging purposes. It might also be of general interest to the curious user.
* Use 'vis.win.file.spell_language' rather than 'spellcheck.lang'Frank Seifferth2021-10-071-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | There is some discussion on the editorconfig side about whether a 'spell_language' key could be added (cf. https://github.com/editorconfig/editorconfig/issues/315, https://github.com/seifferth/vis-editorconfig/pull/8). This key would specify the natural language a file is written in and it would then be up to the editor or plugin doing the spellchecking to respect that setting and behave accordingly. Since it is out of the scope of the vis-editorconfig plugin to implement spellchecking, and since I would like the vis-editorconfig plugin to work both with and without vis-spellcheck, I suggest to use 'vis.win.file.spell_language' to store the document language. With commit 0ee415c in the vis-editorconfig repo (https://github.com/seifferth/vis-editorconfig), this value is already set to the appropriate value. This commit adjusts the spellchecking plugin to use the same global value. I did some testing that suggests it should work. There might still be some hickups if 'vis.win.file' does not exist. This is a non-issue for editorconfig, since editorconfig only works if 'vis.win.file.path' exists (which configuration is used depends on the path). The Readme would also need some adjustment.
* add simple github workflow running static analysisFlorian Fischer2021-04-281-0/+39
|
* add warning if spellcheck is loaded but no supported spellchecker is installedFlorian Fischer2021-04-281-0/+1
|
* fix off-by-one highlighting in non-syntax aware modeFlorian Fischer2021-03-251-1/+1
|
* make typo_style_id configurableFlorian Fischer2021-03-251-2/+3
|
* ignore two luacheck shadowing warningsFlorian Fischer2021-03-201-2/+2
|
* make formatFlorian Fischer2021-03-202-355/+374
|
* add Makefile and lua-format style definitionFlorian Fischer2021-03-202-0/+44
|
* remove whitespace in copyright headerFlorian Fischer2021-03-201-1/+1
|
* Merge pull request #7 from 0x766F6964/check-before-indexingfischerling2021-03-091-1/+5
|\ | | | | check if "LANG" environment variable exists before indexing it
| * check if "LANG" environment variable exists before indexing itRandy Palamar2021-03-081-1/+5
|/
* fix most warnings reported by luacheckFlorian Fischer2021-02-171-18/+18
| | | | | | * Remove unused variables * Remove unused assginments * Fix one actual bug (typo in variable name)
* don't try to use empty correctionsFlorian Fischer2021-02-171-0/+4
|
* Merge pull request #6 from migueldvb/readmefischerling2021-02-141-1/+1
|\ | | | | Use single quotes around plugin path
| * Use quotes around plugin path in installation informationMiguel de Val-Borro2021-02-131-1/+1
|/
* add init.lua and update usage information in ReadmeFlorian Fischer2021-02-062-2/+8
| | | | | | | The init.lua file is only a thin wrapper around a dofile call which loads the actual plugin code in spellcheck.lua and returns the result. Closes #5.
* fix ignoring of words for the syntax aware lex-closure approachFlorian Fischer2021-01-071-0/+11
| | | | | | | Because the lexer.lex wrapper function is a closure it saves the state of the ignored word table in the closure. Therefore to see the effect of ignoring words we must rebuild the wrapper closure.
* Merge pull request #4 from lepotic/masterfischerling2020-12-211-6/+4
|\ | | | | Fix arrows in vis-menu by using vis:pipe()
| * Fix arrows in vis-menu by using vis:pipe()Georgi Kirilov2020-12-201-6/+4
|/
* Merge branch 'syntax_aware' into masterFlorian Fischer2020-09-172-31/+264
|\
| * mention vis.lexers.DEFAULT in Readme and capitalize headlinesFlorian Fischer2020-09-171-4/+4
| |
| * escape magic characters in typosFlorian Fischer2020-08-281-1/+26
| | | | | | | | | | If the typo itself contains magic pattern characters we can't reliable find it in the text.
| * don't stop iterating over typos when an empty one is encounteredFlorian Fischer2020-08-281-2/+2
| | | | | | | | | | | | An iterator in lua stops if it returns nil. This change will get a new typo from the unfiltered_iterator if we encounter an empty one instead of returning nil.
| * ignore empty typosFlorian Fischer2020-08-281-1/+1
| | | | | | | | | | apparently in the typo list produced by aspell there is a blank line which messes with our search for typos.
| * reset last_data when enabling spellcheck to enforce new highlightingFlorian Fischer2020-08-281-0/+2
| |
| * return early if we can't get the typos from our external spellcheckerFlorian Fischer2020-08-281-0/+6
| |
| * Don't fail if the first and only typo is at the end of the text.Florian Fischer2020-08-281-7/+7
| | | | | | | | | | | | | | Before this change we assumed that when we are at the beginning of the text (index == 1) and don't find the typo is must be the beginning of the text but it can also be the end of the text. We now also check the end if the beginning was not what we were lookig for.
| * force a redraw for syntax aware highlighting when spelllang changesFlorian Fischer2020-08-281-6/+7
| |
| * add vis.lexers.DEFAULT to the tokens we spellcheckFlorian Fischer2020-08-271-2/+2
| | | | | | | | | | This activates spellchecking for most "text focused" languages like latex or markdown.
| * don't loop infinitely if a typo spans multiple tokensFlorian Fischer2020-08-271-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This happens because the "default" token gets emitted for each not matched char resulting in lots of small "default" tokens. This markdown: > typu will result in the token stream {"default", 2, "default", 3, "default", 4, "default", 5} and a typo stream with a single entry spanning all of the tokens {{"typu", 1, 5}}. Not checking if the typo is longer then the current token leads to an infinite loop where the typo is always inserted in the new token stream without advancing the token stream.
| * special case typos at the beginning of text as wellFlorian Fischer2020-08-271-7/+20
| |
| * fix highlighting of typos at the end of the textFlorian Fischer2020-08-271-0/+7
| | | | | | | | | | | | | | Our pattern [%A]<typo>[%A] does not match typos at the end or start of the text because there is no leading / trailing non letter character. So if we dind't find the typo with our normal pattern it must be either the start or the end of the text. If not raise a warning that this must be a bug.
| * add the option 'disable_syntax_awareness' to always check the full viewportFlorian Fischer2020-08-262-1/+4
| |
| * update Readme to mention <F7> and th check_tokens variableFlorian Fischer2020-08-261-1/+4
| |
| * remove all the unsound viewport code and cache the full token_stream instead ↵Florian Fischer2020-08-261-29/+9
| | | | | | | | | | | | of typos This should make our spellchecking independent of the current window.
| * fix a off-by-one errorsFlorian Fischer2020-08-261-1/+1
| | | | | | | | | | If the end of a typo equals the end of a token we didn't advance the typo stream entering an infinite loop.
| * change typo_iter to not find typos in correct spelled wordsFlorian Fischer2020-08-261-2/+7
| | | | | | | | | | | | | | | | | | | | When naivingly searching for the typo in our text we might find it before its actual appearense in a correct word containing the typo (e.g. "broken ok" would find the typo "ok" in the middle of the word "broken"). To prevent this we now only find a typo if its enclosed in non-letter characters, this prevents typos from being found in regular words. Typos starting with '"' for example are still found correctly.
| * fix typos in typo_iter documentationFlorian Fischer2020-08-261-2/+2
| |
| * wrap io.open or io.proc calls in assertFlorian Fischer2020-08-261-2/+2
| |
| * implement a new algorithm which calls the external spellchecker at most onceFlorian Fischer2020-08-261-51/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We collect all typos for the current viewport (This is not sound because the viewport we get from vis.win.viewport must not be from the window we currently lex). Then we iterate over both the token stream and the typo stream, adding the token end to the new token stream if it is smaller than the start of the current typo or not a token we spellcheck and advance the token stream. Otherwise we add the token part before our current typo if present and the highlight token representing the typo and advance our typo stream. After we handled all typos we add each leftover token to the new token stream. Typos are cached and reused if the possible viewport and the data we lex are unchanged. (This is sound because, either data is unchanged then we may call the external spellchecker for nothing, or data is the same as last time then the typos haven't changed)
| * remove unused variable definitionsFlorian Fischer2020-08-261-3/+0
| |
| * extent get_typo() to handle string inputsFlorian Fischer2020-08-261-8/+34
| | | | | | | | | | | | | | This allows us to be independent of a vis.window and only use the text passed to lexer.lex for our spellchecking. This is helpfull when the active window is for example the command prompt but the original source file still gets lexed.
| * separate supress_output into redirects for stdout and stderrFlorian Fischer2020-08-261-5/+7
| |
| * extract generic spellchecking functionality from the full viewport functionFlorian Fischer2020-08-261-15/+38
| | | | | | | | | | | | | | | | | | | | | | Add get_typos(range) to retrieve a string of misspelled word in a specific file range by calling the spellchecker's list command. It return nil or a string with each misspell followed by a newline. Introduce typo_iter(text, typos, ignored) to iterate over all not ignored typos and their positions in text. It returns an statefull iterator function closure. Which will return the next typo and ist start and finish in the text, starting by 1.
| * introduce new syntax aware spellchecking mechanismFlorian Fischer2020-08-251-9/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fallback to the old mechanism if no lexer is active. Algorithm: 1. Wrap the active lexer's lex function and save it original value to restore it 2. Obtain the original token stream 3. Filter the tokens for visibility and if we want to spellcheck them (lexers.COMMENT and lexers.STRING by default) 4. Spellcheck the selected token. This is why this is unusably slow we shell out to our spellchecker for each token to check. 5. Split up the selected token into its correct and misspelled parts 6. Insert the correct parts unmodified and the misspelled ones as lexers.ERROR tokens into the token stream Drawbacks: 1. It is unusably slow for now 2. The problem to decide which tokens should be spellchecked still remains. A lexer using different token names than we expect will prevent our spellchecking TODO: 1. Introduce a way to disable syntax aware spellchecking and always use the old check full viewport approach 2. Speedup the syntax aware spellchecking (Maybe by splitting it into two iterations: First collect all toens to spellcheck and shell out once to spellcheck them all Second build up the token stream using the typo information we got)
* | remove fortunatly ignored -a flag from most list commandsFlorian Fischer2020-08-281-7/+7
|/
* fix start index for string.findFlorian Fischer2020-08-251-1/+1
| | | | Lua indexing starts at 1 not 0.