{"_id":"@dmxiaoshubao/vuex-helper-lsp","_rev":"2-6a5a5c73383dd2e815aa587e5d4e5878","name":"@dmxiaoshubao/vuex-helper-lsp","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dmxiaoshubao/vuex-helper-lsp","version":"0.1.0","license":"MIT","_id":"@dmxiaoshubao/vuex-helper-lsp@0.1.0","maintainers":[{"name":"dmxiaoshubao","email":"dmxiaoshubao@126.com"}],"dist":{"shasum":"7e9ee2ad9b21407943953d6ef79809ff30267fb8","tarball":"https://registry.npmjs.org/@dmxiaoshubao/vuex-helper-lsp/-/vuex-helper-lsp-0.1.0.tgz","fileCount":52,"integrity":"sha512-cWcWcfPOS2T4Fchnbf7D06eHugtLvFI0I3GOEgetv5QrWbVFEmyPs+/9DpfcxgvmAhg9DDwv0o6ZdqJwpTZ11w==","signatures":[{"sig":"MEQCIBbBDO07T6Kj7OE5gr+TgTDZurZSzxvJ7/k+yrjdzxb+AiBeQoYSMW1SU9iyeGcT9YPVAOGX9hrwjS6kqhedBB2Mow==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":684312},"main":"out/lsp/server.js","gitHead":"a6228d22d8b62afadf6e373dc3bb4a47708577a5","scripts":{"clean":"node -e \"require('fs').rmSync('out', { recursive: true, force: true })\"","compile":"npm run clean && tsc -p ./","test:lsp":"npm run compile && mocha out/test/setup.js out/test/unit/*lsp*.test.js","test:zed":"npm run test:lsp && npm run check:zed","check:zed":"cargo check --manifest-path extensions/zed/Cargo.toml && cargo build --manifest-path extensions/zed/Cargo.toml --target wasm32-wasip1","start:lsp":"node ./out/lsp/server.js --stdio","prepublishOnly":"npm run test:zed"},"_npmUser":{"name":"dmxiaoshubao","email":"dmxiaoshubao@126.com"},"_npmVersion":"10.9.4","description":"Vuex definition, completion, hover, and diagnostics support for Zed through vuex-helper LSP.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"glob":"^10.5.0","json5":"^2.2.3","@babel/types":"^7.23.0","@babel/parser":"^7.23.0","@babel/traverse":"^7.23.0","vscode-languageserver":"^9.0.1","vscode-languageserver-textdocument":"^1.0.12"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","eslint":"^8.41.0","ts-node":"^10.9.2","proxyquire":"^2.1.3","typescript":"^5.1.3","@types/node":"20.2.5","@types/mocha":"^10.0.1","mock-require":"^3.0.3","@types/vscode":"^1.80.0","@types/babel__core":"^7.20.5","@types/mock-require":"^3.0.0","@types/babel__traverse":"^7.28.0","@typescript-eslint/parser":"^5.59.8","@typescript-eslint/eslint-plugin":"^5.59.8"},"_npmOperationalInternal":{"tmp":"tmp/vuex-helper-lsp_0.1.0_1777900562199_0.28459194164255064","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dmxiaoshubao/vuex-helper-lsp","version":"0.1.1","description":"Vuex definition, completion, hover, and diagnostics support for Zed through vuex-helper LSP.","license":"MIT","main":"out/lsp/server.js","scripts":{"clean":"node -e \"require('fs').rmSync('out', { recursive: true, force: true })\"","compile":"npm run clean && tsc -p ./","start:lsp":"node ./out/lsp/server.js --stdio","test:lsp":"npm run compile && mocha out/test/setup.js out/test/unit/*lsp*.test.js","check:zed":"cargo check --manifest-path extensions/zed/Cargo.toml && cargo build --manifest-path extensions/zed/Cargo.toml --target wasm32-wasip1","test:zed":"npm run test:lsp && npm run check:zed","prepublishOnly":"npm run test:zed"},"devDependencies":{"@types/babel__core":"^7.20.5","@types/babel__traverse":"^7.28.0","@types/mocha":"^10.0.1","@types/mock-require":"^3.0.0","@types/node":"20.2.5","@types/vscode":"^1.80.0","@typescript-eslint/eslint-plugin":"^5.59.8","@typescript-eslint/parser":"^5.59.8","eslint":"^8.41.0","mocha":"^10.2.0","mock-require":"^3.0.3","proxyquire":"^2.1.3","ts-node":"^10.9.2","typescript":"^5.1.3"},"dependencies":{"@babel/parser":"^7.23.0","@babel/traverse":"^7.23.0","@babel/types":"^7.23.0","glob":"^10.5.0","json5":"^2.2.3","vscode-languageserver":"^9.0.1","vscode-languageserver-textdocument":"^1.0.12"},"_id":"@dmxiaoshubao/vuex-helper-lsp@0.1.1","gitHead":"e848c5878c127bd7dba02ebab4473337cc1f60ae","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-/dqNWk2BQDc5NyzyWIU2myvWospf0wvf176rEofHw1lTIajA/74sQEEt9zUgO/XQpfSosi6S65EB0bMb8+SZUQ==","shasum":"5f95b36f004ccb236b97c9bf669ffb08b4a70095","tarball":"https://registry.npmjs.org/@dmxiaoshubao/vuex-helper-lsp/-/vuex-helper-lsp-0.1.1.tgz","fileCount":52,"unpackedSize":689081,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB9VetomiWLkTdNO+SmlBi3yIMAm62i+IySeoOmzcM5EAiA+moHye+um5KBSoI6svlwmcH9GUTYSXpon9Lb2BnK7rg=="}]},"_npmUser":{"name":"dmxiaoshubao","email":"dmxiaoshubao@126.com"},"directories":{},"maintainers":[{"name":"dmxiaoshubao","email":"dmxiaoshubao@126.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vuex-helper-lsp_0.1.1_1777992590550_0.8760983263254578"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-04T13:16:02.107Z","modified":"2026-05-05T14:49:50.897Z","0.1.0":"2026-05-04T13:16:02.377Z","0.1.1":"2026-05-05T14:49:50.763Z"},"license":"MIT","description":"Vuex definition, completion, hover, and diagnostics support for Zed through vuex-helper LSP.","maintainers":[{"name":"dmxiaoshubao","email":"dmxiaoshubao@126.com"}],"readme":"# Vuex Helper for Zed（中文说明）\n\nVuex Helper for Zed 为 Zed 提供 Vuex 2 的跳转、补全、悬浮提示和诊断能力。\n\n只要是 Vuex 开发里常用的辅助能力，这里都会尽量配齐：从发现、补全、跳转、查看到校验，让 Vuex State、Getters、Mutations 和 Actions 的使用更清晰。\n\n## 功能特性\n\n### 1. 跳转定义\n\n从组件中直接跳转到 Vuex Store 的定义处。\n\n#### 演示：跳转定义\n\n#### ![Jump to Definition](images/jump_definition.gif)\n\n- **支持**: `this.$store.state/getters/commit/dispatch`，以及直接导入的 store 实例（如 `import store from '@/store'`）\n- **Map 辅助函数**: `mapState`, `mapGetters`, `mapMutations`, `mapActions`\n- **命名空间**: 支持 namespaced 模块及其嵌套。\n- **可选链**: 支持 `?.` 形式的 store 访问链。\n\n### 2. 智能代码补全\n\n智能提示 Vuex 的各种 key 以及组件中映射的方法。\n\n#### 演示：智能补全\n\n#### ![Code Completion (Variables)](images/auto_tips_and_complete_for_var.gif)\n\n#### ![Code Completion (Functions)](images/auto_tips_and_complete_for_func.gif)\n\n- **上下文感知**: 在 `dispatch` 中提示 Actions，在 `commit` 中提示 Mutations。\n- **命名空间过滤**: 当使用 `mapState('user', [...])` 时，会自动过滤并仅显示 `user` 模块下的内容。\n- **组件映射方法**: 输入 `this.` 即可提示映射的方法（例如 `this.increment` 映射自 `...mapMutations(['increment'])`）。\n- **方括号语法**: 支持 `this['namespace/method']` 语法访问映射属性。\n- **语法支持**: 支持数组语法和对象别名语法（例如 `...mapActions({ alias: 'name' })`）。\n- **导入 Store 补全**: 支持 `import store from '@/store'` 后的 `store.state/getters/commit/dispatch` 补全。\n\n### 3. 悬浮提示与类型推导\n\n无需跳转即可查看文档、类型详情。\n\n#### 演示：悬浮文档\n\n#### ![Hover Info](images/hover_info_and_type_inference.gif)\n\n- **JSDoc 支持**: 提取并显示 Store 定义处的 `/** ... */` 注释文档。\n- **State 类型**: 在悬浮提示中自动推导并显示 State 属性的类型（例如 `(State) appName: string`）。\n- **详细信息**: 显示类型及定义所在的文件路径。\n- **映射方法**: 支持查看映射方法的 Store 文档。\n- **导入 Store 悬浮**: 支持直接导入 store 实例后的悬浮提示。\n\n### 4. Store 内部调用\n\n同样支持在 Vuex Store 内部进行代码补全、跳转和悬浮提示。\n\n#### 演示：Store 内部代码补全、跳转、悬浮提示\n\n#### ![Internal Usage](images/internal_usage.gif)\n\n- **模块作用域**: 当在模块文件中编写 Action 时，`commit` 和 `dispatch` 的代码补全会自动过滤并仅显示当前模块的内容。\n- **Action Context 对象写法**: 支持在 store 文件里识别 `context.state`、`context.getters`、`context.rootState`、`context.rootGetters`。\n- **对象式 Action Handler**: 支持 `actions: { someAction: { handler(ctx) {}, root: true } }` 这类 Vuex 对象式 action 写法。\n\n### 5. 诊断\n\n在 Zed 中直接以 Warning 标记不存在的 Vuex Store 引用。\n\n- **辅助函数**: 校验 `mapState`、`mapGetters`、`mapMutations`、`mapActions` 中的字符串参数。\n- **Commit / Dispatch**: 检查 `commit()` 和 `dispatch()` 的第一个字符串参数。\n- **Store 访问**: 校验 `$store.state/getters` 第一层点号访问和方括号访问。\n- **Store 内部引用**: 校验 store 文件中的 `state.xxx` 访问，以及 `rootState` / `rootGetters` 引用。\n- **全局 Getter 冲突**: 当根模块或非命名空间模块注册了重复的全局 getter 名时给出 Warning。\n- **注释行规避**: 对整行注释中的常见引用不报 Warning。\n\n## 支持的语法示例\n\n- **辅助函数**:\n  ```javascript\n  ...mapState(['count'])\n  ...mapState('user', ['name']) // 命名空间支持\n  ...mapState({ alias: 'count' }) // 对象别名支持\n  ...mapState({ count: state => state.count }) // 箭头函数\n  ...mapState({ count(state) { return state.count } }) // 普通函数\n  ...mapActions({ add: 'increment' }) // 对象别名支持\n  ...mapActions(['add/increment'])\n  ```\n\n- **Store 方法**:\n  ```javascript\n  this.$store.commit('SET_NAME', value);\n  this.$store.dispatch('user/updateName', value);\n  import store from '@/store';\n  store.commit('SET_NAME', value);\n  store?.getters?.['others/hasNotifications'];\n  commit('increment', null, { root: true });\n  actions: {\n    publishProfile: {\n      handler(context) {\n        return context.state.ready;\n      },\n      root: true\n    }\n  }\n  ```\n\n- **组件方法**:\n  ```javascript\n  this.increment(); // 映射自 mapMutations\n  this.appName; // 映射自 mapState\n  ```\n\n## 功能覆盖\n\n| 功能                                        | 状态 | 说明                                               |\n| ------------------------------------------- | ---- | -------------------------------------------------- |\n| `mapState` — 数组语法                       | 支持 | `...mapState(['count'])`                           |\n| `mapState` — 对象字符串别名                 | 支持 | `...mapState({ alias: 'count' })`                  |\n| `mapState` — 箭头函数                       | 支持 | `...mapState({ c: state => state.count })`         |\n| `mapState` — 普通函数                       | 支持 | `...mapState({ c(state) { return state.count } })` |\n| `mapState` — 命名空间                       | 支持 | `...mapState('user', [...])`                       |\n| `mapGetters` — 数组 / 对象                  | 支持 |                                                    |\n| `mapMutations` — 数组 / 对象                | 支持 |                                                    |\n| `mapActions` — 数组 / 对象                  | 支持 |                                                    |\n| `this.$store.state/getters/commit/dispatch` | 支持 | 点号和方括号语法                                   |\n| 导入 store 实例访问                         | 支持 | `import store from '@/store'`                      |\n| Store 可选链访问                            | 支持 | `this.$store?.getters?.['a/b']`                    |\n| `createNamespacedHelpers`                   | 支持 |                                                    |\n| 对象风格 commit                             | 支持 | `commit({ type: 'inc' })`                          |\n| `state` 函数形式                            | 支持 | `state: () => ({})`                                |\n| 嵌套 state                                  | 支持 | 递归解析                                           |\n| 计算属性名                                  | 支持 | ``[SOME_MUTATION]`` ``(state) {}``                 |\n| 动态模块 import/require                     | 支持 | ES Module 和 CommonJS                              |\n| 命名空间模块                                | 支持 | 含嵌套模块                                         |\n| `this` 别名补全                             | 支持 | `const _t = this; _t.`                             |\n| `{ root: true }` 命名空间切换               | 支持 | commit/dispatch 的 root 选项                       |\n| State 链式路径中间词跳转                    | 支持 | 点击 `state.user.name` 中的 `user`                 |\n| Vuex 依赖检测                               | 支持 | 工作区无 Vuex 依赖时静默不激活                     |\n| `rootState` / `rootGetters`                 | 支持 | 补全、跳转、悬浮和诊断                             |\n| `context.state` / `context.getters`         | 支持 | store 文件中的补全、跳转、悬浮与诊断               |\n| 对象式 action handler                       | 支持 | `actions: { save: { handler(ctx) {}, root: true } }` |\n| 嵌套模块命名空间继承                        | 支持 | 子模块在适用时继承父命名空间下的资产               |\n| 全局 getter 冲突诊断                        | 支持 | root 与非 namespaced 模块的重名 getter Warning     |\n| 无效 Store 引用诊断                         | 支持 | 不存在的 state/getter/mutation/action 以 Warning 标记 |\n\n## 使用要求\n\n- Zed 编辑器。\n- 使用 Vuex 2 的 Vue 2 项目。\n- 项目入口建议位于 `src/main.{js,ts}`、`src/index.{js,ts}`，并通过 `new Vue({ store })` 注入 Vuex store。\n\n## 配置项\n\n如果无法自动识别 Vuex store 入口，可以在业务项目的 `.zed/settings.json` 中配置：\n\n```json\n{\n  \"lsp\": {\n    \"vuex-helper\": {\n      \"settings\": {\n        \"storeEntry\": \"src/store/index.js\"\n      }\n    }\n  }\n}\n```\n\n`storeEntry` 支持工作区相对路径；如果项目在 `jsconfig.json` 或 `tsconfig.json` 中配置了路径别名，也支持 `@/store/index.js` 这类别名路径。\n\n## 当前范围\n\n当前 Zed 版本聚焦以下能力：\n\n- 跳转定义\n- 代码补全\n- 悬浮提示\n- 诊断\n\n## 暂不包含\n\n- Rename\n- References\n- Workspace Symbol\n- Code Action\n- Zed 专属配置 UI\n","readmeFilename":"README.zh-CN.md"}