Coder Social home page Coder Social logo

taichi / vscode-textlint Goto Github PK

View Code? Open in Web Editor NEW
57.0 4.0 18.0 1.85 MB

Home Page: https://marketplace.visualstudio.com/items?itemName=taichi.vscode-textlint

License: MIT License

TypeScript 95.82% TeX 0.25% Vue 0.15% JavaScript 3.32% HTML 0.45%
vscode vscode-extension textlint

vscode-textlint's Introduction

vscode-textlint push

Extension to integrate textlint into VSCode.

Development setup

  • open vscode-textlint.code-workspace by VS Code
  • run npm install inside the root folder
  • hit F5 to build and debug the extension

How to release

  1. run npm upgrade inside the root folder
  2. run npm install inside the root folder
  3. run vsce publish inside the packages/textlint folder

vscode-textlint's People

Contributors

azu avatar bells17 avatar coliff avatar dependabot[bot] avatar frozenbonito avatar ksuzu46 avatar linhtto avatar nowsprinting avatar taichi avatar yuiki avatar zaki-yama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-textlint's Issues

`textlint` server crashes on remote ssh from Windows to Linux machine

I get the following error when using remote ssh from a Windows machine to a Linux machine. The nodejs version on the Windows machine is 14.14.

events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  path: '/home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  spawnargs: [
    '-e',
    "var p = process;p.on('message',function(m){if(m.c==='e'){p.exit(0);}else if(m.c==='rs'){try{var r=require.resolve(m.a);p.send({c:'r',s:true,r:r});}catch(err){p.send({c:'r',s:false});}}});",
    ''
  ]
}
[Info  - 10:54:57 AM] Connection to server got closed. Server will restart.
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  path: '/home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  spawnargs: [
    '-e',
    "var p = process;p.on('message',function(m){if(m.c==='e'){p.exit(0);}else if(m.c==='rs'){try{var r=require.resolve(m.a);p.send({c:'r',s:true,r:r});}catch(err){p.send({c:'r',s:false});}}});",
    ''
  ]
}
[Info  - 10:54:58 AM] Connection to server got closed. Server will restart.
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  path: '/home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  spawnargs: [
    '-e',
    "var p = process;p.on('message',function(m){if(m.c==='e'){p.exit(0);}else if(m.c==='rs'){try{var r=require.resolve(m.a);p.send({c:'r',s:true,r:r});}catch(err){p.send({c:'r',s:false});}}});",
    ''
  ]
}
[Info  - 10:54:58 AM] Connection to server got closed. Server will restart.
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  path: '/home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  spawnargs: [
    '-e',
    "var p = process;p.on('message',function(m){if(m.c==='e'){p.exit(0);}else if(m.c==='rs'){try{var r=require.resolve(m.a);p.send({c:'r',s:true,r:r});}catch(err){p.send({c:'r',s:false});}}});",
    ''
  ]
}
[Info  - 10:54:58 AM] Connection to server got closed. Server will restart.
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  path: '/home/swarnendu/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/node',
  spawnargs: [
    '-e',
    "var p = process;p.on('message',function(m){if(m.c==='e'){p.exit(0);}else if(m.c==='rs'){try{var r=require.resolve(m.a);p.send({c:'r',s:true,r:r});}catch(err){p.send({c:'r',s:false});}}});",
    ''
  ]
}
[Error - 10:54:58 AM] Connection to server got closed. Server will not be restarted.

The settings on Windows are as follows.

   "textlint.nodePath": "C:\\Users\\swarnendu\\tmp\\textlint-workspace\\node_modules",
    "textlint.configPath": "D:\\github\\dotfiles\\textlintrc.json"

Do you know what is wrong here?

We get Cannot read property 'parse' of undefined

I got a "Cannot read property" error in the following environment.

  • OS: macOS 10.14.6
  • VSCode: 1.38.1
  • textlint: 11.3.1
  • vscode-textlint: 0.7.0

Detailed error message.

[Error - 9:50:21 AM] Cannot read property 'parse' of undefined
TypeError: Cannot read property 'parse' of undefined
    at repo.newEngine.then.engine (/path/to/.vscode/extensions/taichi.vscode-textlint-0.7.0/node_modules/@taichi/vscode-textlint-server/lib/server.js:166:61)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I think that the way of writing import is wrong.

https://github.com/taichi/vscode-textlint/blob/master/textlint-server/src/server.ts#L9

TypeError [ERR_INVALID_ARG_TYPE]

I get the following error when I open (say) .md files in VS Code. The VS Code version is 1.47.+ and the extension version is 0.8.0. OS is Ubuntu 20.04 and node version is 14.5.0.

[Error - 3:57:04 pm] The "listener" argument must be of type Function. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function. Received type object
    at checkListener (events.js:63:11)
    at _addListener (events.js:219:3)
    at EventEmitter.addListener (events.js:277:10)
    at RuleTypeEmitter.PromiseEventEmitter.on (/home/swarnendu/tmp/textlint-workspace/node_modules/@textlint/kernel/lib/task/promise-event-emitter.js:17:28)
    at /home/swarnendu/tmp/textlint-workspace/node_modules/@textlint/kernel/lib/task/textlint-core-task.js:212:35
    at Array.forEach (<anonymous>)
    at TextLintCoreTask.tryToAddListenRule (/home/swarnendu/tmp/textlint-workspace/node_modules/@textlint/kernel/lib/task/textlint-core-task.js:211:15)
    at /home/swarnendu/tmp/textlint-workspace/node_modules/@textlint/kernel/lib/task/linter-task.js:58:19
    at Array.forEach (<anonymous>)
    at TextLintCoreTask._setupRules (/home/swarnendu/tmp/textlint-workspace/node_modules/@textlint/kernel/lib/task/linter-task.js:49:50)

Textlint server crashes when a file is opened outside a workspace

I use vscode as a default editor for many files, this means when I click a file or run "code filename" in my shell the file gets opened in VScode outside of a workspace, this leads to a crash with textlint server and the following error:

TypeError: e is not iterable
    at /Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:1775
    at Generator.next (<anonymous>)
    at /Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:1381
    at new Promise (<anonymous>)
    at r (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:1126)
    at _ (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:1726)
    at /Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:5455
    at Generator.next (<anonymous>)
    at s (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/server.js:1:1183)
[Error - 10:39:06 AM] Connection to server got closed. Server will not be restarted.
[Error - 10:39:06 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:67080)
	at Object.dispose (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:147163)
	at w.handleConnectionClosed (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:147376)
	at w.handleConnectionClosed (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:207722)
	at t (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:145465)
	at r.invoke (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:68693)
	at o.fire (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:69454)
	at Y (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:56338)
	at r.invoke (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:68693)
	at o.fire (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:69454)
	at d.fireClose (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:77335)
	at ChildProcess.<anonymous> (/Users/username/.vscode/extensions/taichi.vscode-textlint-0.11.0/dist/extension.js:1:88296)
	at ChildProcess.emit (node:events:525:35)
	at maybeClose (node:internal/child_process:1112:16)
	at Socket.<anonymous> (node:internal/child_process:470:11)
	at Socket.emit (node:events:513:28)
	at Pipe.<anonymous> (node:net:757:14)

The error is caused in configureEngine because folders is null based on the return value of getWorkspaceFolders

The workaround right now is opening the folder containing that file upfront as a workspace and then opening the file.

Error - Couldn't start client textlint

I'm attempting to integrate textlint into my developer's workflow using a system-wide configuration (and global textlint installation), however the linter extension fails to run with the error "Couldn't start client textlint".

Textlint has been installed globally, and is available in my path:

matthew.jolly@matt-pc ~ $ textlint -v
v11.8.2

I have provided an absolute path to a textlint configuration file (as yaml). This configuration is valid - I am able to call textlint directly from the command line using it and receive the expected output.

I am not receiving any output from the plugin that would help me narrow down the issue, and I've been able to replicate this on both Windows and Linux machines.

Is there something obvious that I've missed?

Thanks!

Not working with VScode 1.66.2

Hello,

I am using the following VScode version and I installed this plugin but it does not seem to work. I have the textlint installed in global and working from terminal. I have added to node_path and the config file path, I do not see any error but also do not see any highlights.

Version: 1.66.2 (Universal)
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:20.994Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin x64 21.3.0

With verbose setting, I see following output logs

[Info  - 9:21:56 PM] reConfigure
[Info  - 9:21:56 PM] configureEngine file:///<path-to-project>
[Info  - 9:21:56 PM] Module textlint resolve from <path-to-project>
[Info  - 9:21:56 PM] NODE_PATH value is: /usr/local/lib/node_modules
[Info  - 9:21:57 PM] Module textlint got resolved to /usr/local/lib/node_modules/textlint/lib/src/index.js
[Info  - 9:21:57 PM] sendStartProgress 0
[Info  - 9:21:57 PM] sendStopProgress 1

On triggering the fix all auto-fixable problems from the command palette I see following logs,

[Info  - 9:23:14 PM] AllFixesRequest file:///<path-to-project>/readme.txt

Can you please help me to get this working?

Unable to load .textlintignore in vscode-textlint v0.11.0

Hello,

I am using the following VScode version and installed this plugin, but when I use vscode-textlint v0.11.0, .textlintignore is not loaded. v0.9.0 is loaded.

Version: 1.83.1
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:57:32.750Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.3.0

I usually develop in containers using Visual Studio Code Dev Containers, but I saw the same problem in my local environment.

In addition, I'm using the "textlint-rule-general-novel-style-ja" rule

The OUTPUT panel opens automatically in workspaces where textlint is not installed.

If vscode-textlint is installed, the OUTPUT panel will automatically open if you open a workspace that does not use textlint.

This appears to be due to an error output from the extension, which causes the OUTPUT panel to open.
However, this is not an error because you are not actually using textlint.

Therefore, it would be correct to make it a Warning or Info instead of an error log.

Reproduce

  1. Install vscode-textlint
  2. Open non-textlint project
  3. Show "OUTPUT" automaticaly
image

output warns

(node:22320) DeprecationWarning: textlint: TextLintCore is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310

You can control this deprecation message by Node.js command-line flags.

If the NODE_OPTIONS=--throw-deprecation is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
If the NODE_OPTIONS=--no-deprecation is used, the deprecation warning is suppressed.
If the NODE_OPTIONS=--trace-deprecation is used, the deprecation warning is printed to stderr along with the full stack trace.
        

(Use `Code --trace-deprecation ...` to show where the warning was created)
(node:22320) DeprecationWarning: textlint: TextLintEngine is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310

You can control this deprecation message by Node.js command-line flags.

If the NODE_OPTIONS=--throw-deprecation is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
If the NODE_OPTIONS=--no-deprecation is used, the deprecation warning is suppressed.
If the NODE_OPTIONS=--trace-deprecation is used, the deprecation warning is printed to stderr along with the full stack trace.
        

(node:22320) DeprecationWarning: textlint: TextLintCore is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310

You can control this deprecation message by Node.js command-line flags.

If the NODE_OPTIONS=--throw-deprecation is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
If the NODE_OPTIONS=--no-deprecation is used, the deprecation warning is suppressed.
If the NODE_OPTIONS=--trace-deprecation is used, the deprecation warning is printed to stderr along with the full stack trace.
        

(node:22320) DeprecationWarning: textlint: TextLintEngine is deprecated. Please use new APIs https://github.com/textlint/textlint/issues/1310

You can control this deprecation message by Node.js command-line flags.

If the NODE_OPTIONS=--throw-deprecation is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
If the NODE_OPTIONS=--no-deprecation is used, the deprecation warning is suppressed.
If the NODE_OPTIONS=--trace-deprecation is used, the deprecation warning is printed to stderr along with the full stack trace.

Sometimes, I feel uneasy with this extension works or not.
Output like this irritate me

Allows to handle multiple textlint configurations

Hi.

I've using multiple .textlintrc to handle i18n matters,
as a npm script like following:
npx textlint --config .textlintrc.en.json "contents/en/**/*.*" && npx textlint --config .textlintrc.jajson "contents/ja/**/*.*"
(Also this can be work on CI test as doing above 2 processes without any defect)

Is there any way to run on 2 configs & executing toward each target resources?

The message 'A request has failed. See the output for more information.' displays repeatedly.

vscode-textlint is getting error continuously.

Here is the message below.
How can I solve it?

[Error - 3:11:56 AM] Range#create called with invalid arguments[[object Object], [object Object], undefined, undefined]
Error: Range#create called with invalid arguments[[object Object], [object Object], undefined, undefined]
    at Object.create (/Users/yutaro/.vscode/extensions/taichi.vscode-textlint-0.9.0/node_modules/vscode-languageserver-types/lib/umd/main.js:71:23)
    at toDiagnostic (/Users/yutaro/.vscode/extensions/taichi.vscode-textlint-0.9.0/node_modules/@taichi/vscode-textlint-server/lib/server.js:251:29)
    at Array.map (<anonymous>)
    at /Users/yutaro/.vscode/extensions/taichi.vscode-textlint-0.9.0/node_modules/@taichi/vscode-textlint-server/lib/server.js:210:30
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 2)

Here is the information of my environment.

バージョン: 1.60.2
コミット: 7f6ab5485bbc008386c4386d08766667e155244e
日付: 2021-09-22T11:59:27.195Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

Enable to emit activation events on all language files

Hello,

I'm using textlint processor plugin for new file format support.
However, ActivationEvents is not emitted when it changed.

It is good if it is enable to emit activation events on all language files.

"activationEvents": [
"onLanguage:html",
"onLanguage:plaintext",
"onLanguage:markdown",
"onLanguage:latex",
"onLanguage:tex",
"onLanguage:pdf",
"onLanguage:django-txt",
"onLanguage:django-html",
"onLanguage:doctex",
"onLanguage:restructuredtext",
"onCommand:textlint.showOutputChannel",
"onCommand:textlint.createConfig",
"onCommand:textlint.executeAutofix"
],

Additionally, if your extension needs to be activated before any language is used, you can use the generic onLanguage activation event to ensure this:

"activationEvents": [
    "onLanguage"
]

https://code.visualstudio.com/api/references/activation-events#onLanguage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.