Misc update
This commit is contained in:
parent
7f3178c71e
commit
0a42421055
|
@ -36,7 +36,7 @@ See `File -> Preferences -> Settings -> Extensions -> Texinfo` for details. The
|
||||||
|
|
||||||
* If syntax highlighting is not satisfactory, try another color theme where keyword/operator colors are distinct (e.g. Solarized Light/Dark, Monokai).
|
* If syntax highlighting is not satisfactory, try another color theme where keyword/operator colors are distinct (e.g. Solarized Light/Dark, Monokai).
|
||||||
* Preview content is updated on document save rather than document change.
|
* Preview content is updated on document save rather than document change.
|
||||||
* For macOS users: Version of preinstalled GNU Texinfo is very old, use a latest one instead. This can be easily done by `brew install texinfo` and change extension setting `texinfo.makeinfo` value.
|
* For macOS users: Preinstalled GNU Texinfo distribution is very old. Use a latest one instead. This can be easily done by `brew install texinfo` and change extension setting `texinfo.makeinfo` value.
|
||||||
|
|
||||||
## Future Plans
|
## Future Plans
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"comments": {
|
||||||
|
"lineComment": "@c"
|
||||||
|
},
|
||||||
|
"brackets": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"],
|
||||||
|
["``", "''"]
|
||||||
|
],
|
||||||
|
"autoClosingPairs": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"]
|
||||||
|
],
|
||||||
|
"surroundingPairs": [
|
||||||
|
["{", "}"],
|
||||||
|
["[", "]"],
|
||||||
|
["(", ")"],
|
||||||
|
["`", "'"]
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"comments": {
|
|
||||||
"lineComment": "@c"
|
|
||||||
},
|
|
||||||
"brackets": [
|
|
||||||
["{", "}"]
|
|
||||||
],
|
|
||||||
"autoClosingPairs": [
|
|
||||||
["{", "}"]
|
|
||||||
],
|
|
||||||
"surroundingPairs": [
|
|
||||||
["{", "}"]
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -160,15 +160,14 @@
|
||||||
".texinfo",
|
".texinfo",
|
||||||
".txi"
|
".txi"
|
||||||
],
|
],
|
||||||
"configuration": "./language-configuration.json"
|
"configuration": "./language-config.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grammars": [
|
"grammars": [
|
||||||
{
|
{
|
||||||
"language": "texinfo",
|
"language": "texinfo",
|
||||||
"scopeName": "text.texinfo",
|
"scopeName": "text.texinfo",
|
||||||
"path": "./out/texinfo.tmGrammar.json",
|
"path": "./out/grammars/texinfo.json"
|
||||||
"configuration": "./language-configuration.json"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
mkdir -p ./out
|
mkdir -p ./out/grammars
|
||||||
|
|
||||||
# Convert TextMate grammar from CSON to JSON (VSCode cannot recognize CSON ones).
|
# Convert TextMate grammar from CSON to JSON (VSCode cannot recognize CSON ones).
|
||||||
TMGRAMMAR_CSON=./node_modules/language-texinfo/grammars/texinfo.cson
|
TMGRAMMAR_CSON=./node_modules/language-texinfo/grammars/texinfo.cson
|
||||||
TMGRAMMAR_JSON=./out/texinfo.tmGrammar.json
|
TMGRAMMAR_JSON=./out/grammars/texinfo.json
|
||||||
cson2json $TMGRAMMAR_CSON > $TMGRAMMAR_JSON
|
cson2json $TMGRAMMAR_CSON > $TMGRAMMAR_JSON
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class FoldingRangeContext {
|
||||||
|
|
||||||
private bufferedFoldingRanges?: vscode.FoldingRange[];
|
private bufferedFoldingRanges?: vscode.FoldingRange[];
|
||||||
|
|
||||||
private commentRange?: [number, number];
|
private commentRange?: { start: number, end: number };
|
||||||
|
|
||||||
private headerStart?: number;
|
private headerStart?: number;
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ export class FoldingRangeContext {
|
||||||
* @param end Ending line number.
|
* @param end Ending line number.
|
||||||
*/
|
*/
|
||||||
private calculateFoldingRanges() {
|
private calculateFoldingRanges() {
|
||||||
this.commentRange = undefined;
|
|
||||||
this.headerStart = undefined;
|
this.headerStart = undefined;
|
||||||
const closingBlocks = <{ name: string, line: number }[]>[];
|
const closingBlocks = <{ name: string, line: number }[]>[];
|
||||||
for (let idx = this.document.lineCount - 1; idx >= 0; --idx) {
|
for (let idx = this.document.lineCount - 1; idx >= 0; --idx) {
|
||||||
|
@ -116,7 +115,7 @@ export class FoldingRangeContext {
|
||||||
} else {
|
} else {
|
||||||
const closingBlock = closingBlocks.pop();
|
const closingBlock = closingBlocks.pop();
|
||||||
if (closingBlock === undefined) {
|
if (closingBlock === undefined) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
if (line.substring(1, closingBlock.name.length + 2).trim() === closingBlock.name) {
|
if (line.substring(1, closingBlock.name.length + 2).trim() === closingBlock.name) {
|
||||||
this.insertRange(idx, closingBlock.line);
|
this.insertRange(idx, closingBlock.line);
|
||||||
|
@ -126,9 +125,9 @@ export class FoldingRangeContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.commentRange !== undefined) {
|
if (this.commentRange !== undefined) {
|
||||||
this.insertRange(this.commentRange[0], this.commentRange[1], vscode.FoldingRangeKind.Comment);
|
this.insertRange(this.commentRange.start, this.commentRange.end, vscode.FoldingRangeKind.Comment);
|
||||||
}
|
}
|
||||||
return this.bufferedFoldingRanges;
|
this.commentRange = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private processComment(lineText: string, lineNum: number) {
|
private processComment(lineText: string, lineNum: number) {
|
||||||
|
@ -147,12 +146,12 @@ export class FoldingRangeContext {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.commentRange === undefined) {
|
if (this.commentRange === undefined) {
|
||||||
this.commentRange = [lineNum, lineNum];
|
this.commentRange = { start: lineNum, end: lineNum };
|
||||||
} else if (this.commentRange[0] - 1 === lineNum) {
|
} else if (this.commentRange.start - 1 === lineNum) {
|
||||||
this.commentRange[0] = lineNum;
|
this.commentRange.start = lineNum;
|
||||||
} else {
|
} else {
|
||||||
this.insertRange(this.commentRange[0], this.commentRange[1], vscode.FoldingRangeKind.Comment);
|
this.insertRange(this.commentRange.start, this.commentRange.end, vscode.FoldingRangeKind.Comment);
|
||||||
this.commentRange = [lineNum, lineNum];
|
this.commentRange = { start: lineNum, end: lineNum };
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
let options: Options | undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch extension option values.
|
* Fetch extension option values.
|
||||||
*
|
*
|
||||||
|
@ -16,12 +14,14 @@ let options: Options | undefined;
|
||||||
*/
|
*/
|
||||||
export default class Options {
|
export default class Options {
|
||||||
|
|
||||||
|
private static singleton?: Options;
|
||||||
|
|
||||||
private static get instance() {
|
private static get instance() {
|
||||||
return options ?? (options = new Options('texinfo'));
|
return Options.singleton ?? (Options.singleton = new Options('texinfo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
static clear() {
|
static clear() {
|
||||||
options = undefined;
|
Options.singleton = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get makeinfo() {
|
static get makeinfo() {
|
||||||
|
|
|
@ -126,8 +126,6 @@ export default class Preview {
|
||||||
this.updating = false;
|
this.updating = false;
|
||||||
this.updateTitle();
|
this.updateTitle();
|
||||||
|
|
||||||
if (this.pendingUpdate) {
|
this.pendingUpdate && this.updateWebview();
|
||||||
this.updateWebview();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue