Code Monkey home page Code Monkey logo

vscode-fecs-plugin's Introduction

vscode-fecs-plugin

一个凑合能用的 FECS 的 vscode 扩展。 致敬 SublimeLinter-contrib-fecsVScode-fecs

安装

打开 这个页面 点击 Install 按钮就行安装, 或在 vscode 里的命令面板输入 ext install vscode-fecs-plugin 进行安装。

功能

Fecs 格式化

  • 执行命令: vscode-fecs-plugin: Format
    • 快捷键: cmd+shift+r
  • 支持保存时自动格式化
    • 配置 vscode-fecs-plugin.autoFormatOnSave to true 即可启用

Fecs 检查

  • 默认启用
    • 可以禁用, 配置 vscode-fecs-plugin.disableCheck to true 即可
  • 支持 .fecsrc
  • 支持临时禁用、启用, 执行命令:
    • vscode-fecs-plugin: Disable check
    • vscode-fecs-plugin: Enable check
  • 支持对选中的代码块快速添加豁免注释 (仅支持 eslint), 若没有选中代码, 则仅处理光标所在行
    • 执行命令 vscode-fecs-plugin: Add disable rule comments: 仅在有错误的行前后添加注释
    • 执行命令 vscode-fecs-plugin: Add disable rule comments for entire selection block: 在整个代码块前后添加注释
    • 鼠标 hover 到报错处点击快速修复, 可以给该行添加豁免注释

    不要滥用!!!

  • 默认会忽略 /* eslint-disalbe */
    • 可以配置 vscode-fecs-plugin.ignoreGlobalEslintDisalbe to false 来禁用这个功能
  • 通过以下任一方式可以打开浏览器搜索命中的错误规则
    • 执行命令 vscode-fecs-plugin: Search rule in browser
    • 点击底部状态栏的错误信息
  • Demo javascript

注意: 若在 vscode 里断点调试代码, 这些小红点、小黄点可能把断点的那个小圆点遮住。

有时候状态栏的错误信息可能因为太长而被挤下去, 导致看不到, 这时你可以安装这个插件, 同时使用这个脚本 (script/statusBarItemWidthFix.js) 来缓解这个问题。

支持的文件类型

基于文件的扩展名来做支持判断, 若扩展名为空, 以当前文件的 language id 来判断。

  • javascript

  • typescript

    使用 typescript-eslint 来做检测

  • css

  • less

  • html

  • 各种 Vue 单文件组件格式的文件:

    • vue
    • san
    • atom

可以通过 jsLikeExt, cssLikeExt, htmlLikeExt, vueLikeExt 等配置来支持更多的文件格式, 具体参考下面的配置说明

支持仅针对特定的 git 仓库启用此插件

若配置了 supportByGitDomainTest 字段, 则此插件只会对 git 仓库的文件进行检测, 且仓库的远程 url 必须匹配这个配置项里的其中一项。

示例:

  • supportByGitDomainTest: ['.github.com']: 只对 github 的代码库启用
  • supportByGitDomainTest: ['.gitlab.com']: 只对 gitlab 的代码库启用
  • supportByGitDomainTest: ['.github.com', '.gitlab.com']: 同时对 github/gitlab 的代码库启用

配置说明

插件支持以下配置项:

  • vscode-fecs-plugin.disableCheck: 是否默认禁用检测, 默认为 false, 不禁用
  • vscode-fecs-plugin.ignoreGlobalEslintDisalbe: 是否忽略 /* eslint-disalbe */ 注释, 默认为 true, 忽略
  • vscode-fecs-plugin.en: 是否使用英文输出错误信息, 默认为 false, 使用中文输出
  • vscode-fecs-plugin.level: 输出错误级别, 0(both), 1(warn), 2(error), 默认为 0
  • vscode-fecs-plugin.jsLikeExt: 配置类似 js 的文件类型
  • vscode-fecs-plugin.cssLikeExt: 配置类似 css 的文件类型
  • vscode-fecs-plugin.htmlLikeExt: 配置类似 html 的文件类型
  • vscode-fecs-plugin.vueLikeExt: 配置类似 vue 的文件类型
  • vscode-fecs-plugin.supportByGitDomainTest: 支持仅针对特定的 git 仓库启用此插件
  • vscode-fecs-plugin.excludePaths: 不做检查的代码路径, 比如 dist, output
  • vscode-fecs-plugin.excludeFileNameSuffixes: 不做检查的文件名后缀, 比如 .min.js
  • vscode-fecs-plugin.searchUrl: 发起搜索的 url, 会把其中的 ${query} 替换为命中的规则
  • vscode-fecs-plugin.autoFormatOnSave: 是否在保存文件时自动格式化, 默认为 false, 不保存

加油!

vscode-fecs-plugin's People

Contributors

dafrok avatar kidnes avatar l5oo00 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

Watchers

 avatar  avatar  avatar

vscode-fecs-plugin's Issues

Error: Cannot find module 'fecs'

在Mac的vscode 1.13.1版本中安装 vscode-fecs-plugin0.0.5版后使用时出现提示:

JS999: Error: Cannot find module '/Users/xxx/vscode-fecs-plugin/node_modules/fecs/lib/js/esnext'( at Function.Module._resolveFilename (module.js). (rule: syntax)'
at: '470,15'

然后自己新建目录 /Users/YL07/Project/git_repo/ 并将工程克隆下来后就没这个错误提示了。。 可能是哪个地方引用或者配置有问题

The keyword 'import' is reserved

JS998: [强制] 存在兼容性问题或运行时错误。(Parsing error: The keyword 'import' is reserved)
现行版本: v1.0.0

还原到之前的版本是没有问题的

关于fecsrc的建议

  1. 建议根据项目中配置的.fecsrc文件显示提示
  2. 建议可配置为根据项目中是否存在.fecsrc来确定是否显示提示

windows下不好用

1、直接在终端执行fecs,检查是没有问题的。
image

2、但是不管是FECS插件还是这个vscode-fecs-plugin插件,都检测不到错误。(已经禁用其他所有插件,排除干扰)
image

3、重启、重装都不好使。现在被迫使用笨重的webstrom,求大神排查解决~~

VS Code信息:
版本 1.22.2
提交 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
日期 2018-04-12T16:38:45.278Z
Shell 1.7.12
渲染器 58.0.3029.110
Node 7.9.0
架构 x64

fecs 版本:
$ fecs -v
fecs 1.5.5

系统:
win10-1706-专业版

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.