Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Allowing linter-spell-latex to activate and to ignore most LaTeX syntax in spelling #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and [language-latex](https://atom.io/packages/language-latex).

The package has support for the following TeX Magic comment

* `%!TeX spellcheck = en-US,en-DE` Select languages
* `%!TeX spellcheck = en-US, de-DE` Select languages

## Status

Expand Down
4 changes: 2 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { CompositeDisposable } from 'atom'

const magicSpellCheckPattern = /^%\s*!TEX\s+spellcheck\s*=\s*(.*)$/im
const ignorePattern = /[0-9]+(pt|mm|cm|in|ex|em|bp|pc|dd|cc|sp)/
const ignorePattern = /([-0-9.]+ ?(pt|mm|cm|in|ex|em|bp|pc|dd|cc|sp))|(\\(documentclass|usepackage|input|chapter|section|subsection|subsubsection|paragraph|begin|end|cite|cited|citep|ref|vspace|hspace|includegraphics|label|tag|bibliographystyle|biboptions)\*?(\[.+?\])?(\{.+?\})?)(\[.+?\])?|(\\\w+)/
const grammarScopes = ['text.tex', 'text.tex.latex', 'text.tex.latex.memoir', 'text.tex.latex.beamer']

export default {
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
'text.tex': true,
'variable.parameter.function.latex': false
},
getRanges: (textEditor, ranges) => {
filterRanges: (textEditor, ranges) => {
let ignoredRanges = []
for (const searchRange of ranges) {
textEditor.scanInBufferRange(ignorePattern, searchRange, ({range}) => {
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
"package-deps": [
"linter-spell"
],
"activationHooks": [
"language-latex:grammar-used",
"language-tex:grammar-used",
"language-latex2e:grammar-used"
],
"standard": {
"parser": "babel-eslint",
"globals": [
Expand Down