Comments (5)
Hi @valentjn, thanks for your answer. Now I understand more.
For those who will land on this question/issue, here is the excerpt of the settings file that should be given to the --settings-file
option (in my use case the input document is in french):
{
"language": "fr",
"dictionary": {
"fr": [
"Tehemten",
"Akwan",
"Rustem",
"Touran",
"Raksch",
"farsangs",
"Divs",
// other words omitted for brevity
]
},
"hiddenFalsePositives": {
"fr": [
{
"rule": "D_N",
"sentence": "^\\QLorsqu'il fut revenu auprès de la source, méditant dans son âme guerrière de nouvelles luttes, le Div Akwan l'accosta de nouveau et lui dit :\\E$"
},
{
"rule": "D_N",
"sentence": "^\\QTehemten répondit aux paroles du Div par un mugissement de lion , détacha du crochet son lacet roulé, le lança et prit le Div au milieu du corps.\\E$"
},
// other rules omitted for brevity
]
}
}
Basically, it is just a copy/paste of the files generated by the VSCode extension vscode-ltex under the .vscode
folder.
I will provide soon in this discussion a node-js script that automatically create that settings files from the ones (ltex.dictionary.fr.txt
, ltex.hiddenFalsePositives.fr.txt
, settings.json
) found in the .vscode
folder
from ltex-ls.
There is an example in the docs under --settings-file
.
You have to remove the ltex.
prefixes to make it work (this stems from the configuration format the LSP mandates). Now that I think about it, you probably also have to unfold everything (that part is missing in the docs). So {"ltex.latex.commands": ...}
becomes {"latex": {"commands": ...}}
.
I see why this could confuse people, and it's a good idea to support both possibilities. Keep in mind, though, that VS Code is not the only editor LTEX LS supports; other editors might have different setting formats.
from ltex-ls.
Here is the script that builds the needed settings file from what has been generated by the VSCode extension (this sample code handles only french files):
const ltexFrDictionaryFile = path.join(process.cwd(), '.vscode', 'ltex.dictionary.fr.txt');
const frDictionary = readAllLinesInFile(ltexFrDictionaryFile).filter(
(line) => line && line.length > 0,
);
const frFalsePositiveFile = path.join(
process.cwd(),
'.vscode',
'ltex.hiddenFalsePositives.fr.txt',
);
const frFalsePositives = readAllLinesInFile(frFalsePositiveFile)
.filter((line) => line && line.length > 0)
.map((rawRule) => JSON.parse(rawRule));
const frLtexLsSettings = {
language: 'fr',
dictionary: { fr: frDictionary },
hiddenFalsePositives: { fr: frFalsePositives },
};
writeFileSync(
path.join(process.cwd(), 'ltex-settings.fr.json'),
JSON.stringify(frLtexLsSettings, null, 2),
);
readAllLinesInFile
:
export const readAllLinesInFile = (filePath: PathLike): string[] => {
const lines = readFileSync(filePath, 'utf8').split(/\n|\r/);
return lines;
};
from ltex-ls.
LTEX LS can now parse flattened JSON objects as well, with or without ltex.
prefix. Look in the readme/CLI help for examples.
Note that the settings JSON of the screenshot in the description of this issue won't work though, because that's not valid JSON (has trailing commas). Only valid JSON is supported (no trailing commas, no comments).
from ltex-ls.
Feature released in 13.0.0.
from ltex-ls.
Related Issues (20)
- Support additional LaTeX commands and environments in ltex-ls
- Can not add words to dictionary
- Some way to change buffer's language.
- Build for BSD HOT 1
- Can we read credentials from a file?
- Allow only linting comments matching a pattern, e.g. `//!` and `///` in rust instead of `//`
- Sending workspace/configuration requests to client without capability
- Checking "!}" or "?}" with LanguageTool premium server in French.
- Version 16.0.0 doesn't work with PASSIVE_VOICE
- What is the default value of `LTEX_GLOBAL_STORAGE_PATH`? HOT 3
- language selection via \documentclass[german]{article} and similar
- ltex with html: Within source tag no html check
- Markdown inline footnotes
- `JAVA_HOME is not defined correctly`
- Add text (.txt) files support HOT 1
- Linux binary archive changes destination owner when extracted
- restructuredText ltex.hiddenFalsePositive HOT 1
- High memory usage HOT 1
- StringIndexOutOfBoundsException HOT 1
- How to set Ltex language in vim
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ltex-ls.