Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
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
6 changes: 5 additions & 1 deletion packages/test/.textlintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"plugins": {
"html": true,
"html": {
"extensions": [
".js"
]
},
"latex2e": true
},
"filters": {},
Expand Down
11 changes: 10 additions & 1 deletion packages/test/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"textlint.run": "onType",
"textlint.autoFixOnSave": false,
"textlint.trace": "verbose"
"textlint.trace": "verbose",
"textlint.languages": [
"markdown",
"plaintext",
"html",
"tex",
"latex",
"doctex",
"javascript"
]
}
1 change: 1 addition & 0 deletions packages/test/testtest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: This is a validated target.
1 change: 1 addition & 0 deletions packages/test/testtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: This is NOT a validated target.
13 changes: 2 additions & 11 deletions packages/textlint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,7 @@
}
},
"activationEvents": [
"onLanguage:html",
"onLanguage:plaintext",
"onLanguage:markdown",
"onLanguage:latex",
"onLanguage:tex",
"onLanguage:pdf",
"onLanguage:django-txt",
"onLanguage:django-html",
"onLanguage:doctex",
"onLanguage:restructuredtext",
"onLanguage",
"onCommand:textlint.showOutputChannel",
"onCommand:textlint.createConfig",
"onCommand:textlint.executeAutofix"
Expand All @@ -151,7 +142,7 @@
"webpack-cli": "^4.9.1"
},
"engines": {
"vscode": "^1.61.0"
"vscode": "^1.74.0"
},
"icon": "textlint-icon_128x128.png",
"galleryBanner": {
Expand Down
2 changes: 1 addition & 1 deletion packages/textlint/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function configureAutoFixOnSave(client: LanguageClient) {
disposeAutoFixOnSave();

if (auto) {
const languages = new Set(getConfig("languages"));
const languages = new Set(getConfig<string[]>("languages", []));
autoFixOnSave = workspace.onWillSaveTextDocument((event) => {
const doc = event.document;
const target = getConfig("targetPath", null);
Expand Down
24 changes: 18 additions & 6 deletions packages/textlint/src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ export class StatusBar {
this._delegate.hide();
}
}
activate(languageId: string) {
if (languageId === "") {
return;
}

if (-1 !== this._supports.indexOf(languageId)) {
this._delegate.color = "";
this._delegate.tooltip =
"need to restart this extension or check this extension setting and .textlintrc if textlint is not working.";
} else {
this._delegate.color = "#818589";
this._delegate.tooltip = `textlint is inanctive on ${languageId}.`;
}
}

get status(): Status {
return this._status;
Expand All @@ -73,7 +87,7 @@ export class StatusBar {

set serverRunning(sr: boolean) {
this._serverRunning = sr;
this._delegate.tooltip = sr ? "textlint server is running." : "textlint server stopped.";
window.showInformationMessage(sr ? "textlint server is running." : "textlint server stopped.");
this.update();
}

Expand All @@ -83,11 +97,9 @@ export class StatusBar {

updateWith(editor: TextEditor) {
this._delegate.text = this.status.label;
this.show(
this.serverRunning === false ||
this._status !== Status.OK ||
(editor && 0 < this._supports.indexOf(editor.document.languageId))
);
const languageId = editor?.document.languageId ?? "";
this.activate(languageId);
this.show(this.serverRunning === false || this._status !== Status.OK || -1 !== this._supports.indexOf(languageId));
}

startProgress() {
Expand Down