Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
bcb2728bcd | ||
|
|
5c50215d39 | ||
|
|
03ed6be82d | ||
|
|
beee4cb633 | ||
|
|
21c2934a36 | ||
|
|
d9ff048a14 | ||
|
|
a8ce8048f8 | ||
|
|
831cd59ab0 | ||
|
|
ec41d3c4a0 | ||
|
|
6bcf99778a | ||
|
|
6d59cf377c | ||
|
|
0217586e2e | ||
|
|
db3b17d863 | ||
|
|
f0261719b8 | ||
|
|
b556a064e3 | ||
|
|
feb882ed10 | ||
|
|
e82d766804 | ||
|
|
5e099ecb5b | ||
|
|
7531834b3c | ||
|
|
0ab50e0dd4 |
No files matched your search
@@ -33,6 +33,3 @@ playwright-report/
|
||||
# Local AI agent files
|
||||
CLAUDE.md
|
||||
.claude/
|
||||
|
||||
# Local reference screenshots
|
||||
pycharm-screenshots/
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"printWidth": 120,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "all",
|
||||
"sortPackageJson": false,
|
||||
"ignorePatterns": ["dist", "target", "src/bindings.ts", "pnpm-lock.yaml", "**/*.toml"]
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["typescript", "react"],
|
||||
"categories": {
|
||||
"correctness": "off"
|
||||
},
|
||||
"env": {
|
||||
"builtin": true
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"dist",
|
||||
"target",
|
||||
"src-tauri",
|
||||
"crates",
|
||||
"src/bindings.ts",
|
||||
"fixtures",
|
||||
"plugins",
|
||||
"test-results",
|
||||
"playwright-report",
|
||||
".claude"
|
||||
],
|
||||
"rules": {
|
||||
"constructor-super": "error",
|
||||
"for-direction": "error",
|
||||
"getter-return": "error",
|
||||
"no-async-promise-executor": "error",
|
||||
"no-case-declarations": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-compare-neg-zero": "error",
|
||||
"no-cond-assign": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-constant-binary-expression": "error",
|
||||
"no-constant-condition": "error",
|
||||
"no-control-regex": "error",
|
||||
"no-debugger": "error",
|
||||
"no-delete-var": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-dupe-else-if": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-empty": "error",
|
||||
"no-empty-character-class": "error",
|
||||
"no-empty-pattern": "error",
|
||||
"no-empty-static-block": "error",
|
||||
"no-ex-assign": "error",
|
||||
"no-extra-boolean-cast": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-func-assign": "error",
|
||||
"no-global-assign": "error",
|
||||
"no-import-assign": "error",
|
||||
"no-invalid-regexp": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"no-loss-of-precision": "error",
|
||||
"no-misleading-character-class": "error",
|
||||
"no-new-native-nonconstructor": "error",
|
||||
"no-nonoctal-decimal-escape": "error",
|
||||
"no-obj-calls": "error",
|
||||
"no-prototype-builtins": "error",
|
||||
"no-redeclare": "error",
|
||||
"no-regex-spaces": "error",
|
||||
"no-self-assign": "error",
|
||||
"no-setter-return": "error",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-sparse-arrays": "error",
|
||||
"no-this-before-super": "error",
|
||||
"no-unassigned-vars": "error",
|
||||
"no-unexpected-multiline": "error",
|
||||
"no-unreachable": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unsafe-negation": "error",
|
||||
"no-unsafe-optional-chaining": "error",
|
||||
"no-unused-labels": "error",
|
||||
"no-unused-private-class-members": "error",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"no-useless-backreference": "error",
|
||||
"no-useless-catch": "error",
|
||||
"no-useless-escape": "error",
|
||||
"no-with": "error",
|
||||
"preserve-caught-error": "error",
|
||||
"require-yield": "error",
|
||||
"use-isnan": "error",
|
||||
"valid-typeof": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"react/rules-of-hooks": "error",
|
||||
"react/exhaustive-deps": "warn",
|
||||
"react/static-components": "error",
|
||||
"react/use-memo": "error",
|
||||
"react/preserve-manual-memoization": "error",
|
||||
"react/incompatible-library": "warn",
|
||||
"react/immutability": "error",
|
||||
"react/globals": "error",
|
||||
"react/refs": "error",
|
||||
"react/set-state-in-effect": "error",
|
||||
"react/error-boundaries": "error",
|
||||
"react/purity": "error",
|
||||
"react/set-state-in-render": "error",
|
||||
"react/unsupported-syntax": "warn",
|
||||
"typescript/ban-ts-comment": "error",
|
||||
"typescript/no-duplicate-enum-values": "error",
|
||||
"typescript/no-empty-object-type": "error",
|
||||
"typescript/no-explicit-any": "error",
|
||||
"typescript/no-extra-non-null-assertion": "error",
|
||||
"typescript/no-misused-new": "error",
|
||||
"typescript/no-namespace": "error",
|
||||
"typescript/no-non-null-asserted-optional-chain": "error",
|
||||
"typescript/no-require-imports": "error",
|
||||
"typescript/no-this-alias": "error",
|
||||
"typescript/no-unnecessary-type-constraint": "error",
|
||||
"typescript/no-unsafe-declaration-merging": "error",
|
||||
"typescript/no-unsafe-function-type": "error",
|
||||
"typescript/no-wrapper-object-types": "error",
|
||||
"typescript/prefer-as-const": "error",
|
||||
"typescript/prefer-namespace-keyword": "error",
|
||||
"typescript/triple-slash-reference": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
||||
"rules": {
|
||||
"constructor-super": "off",
|
||||
"getter-return": "off",
|
||||
"no-class-assign": "off",
|
||||
"no-const-assign": "off",
|
||||
"no-dupe-class-members": "off",
|
||||
"no-dupe-keys": "off",
|
||||
"no-func-assign": "off",
|
||||
"no-import-assign": "off",
|
||||
"no-new-native-nonconstructor": "off",
|
||||
"no-obj-calls": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-setter-return": "off",
|
||||
"no-this-before-super": "off",
|
||||
"no-unreachable": "off",
|
||||
"no-unsafe-negation": "off",
|
||||
"no-var": "error",
|
||||
"no-with": "off",
|
||||
"prefer-const": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
dist
|
||||
target
|
||||
src/bindings.ts
|
||||
pnpm-lock.yaml
|
||||
@@ -0,0 +1 @@
|
||||
{ "printWidth": 120, "semi": true, "singleQuote": false, "trailingComma": "all" }
|
||||
@@ -3974,7 +3974,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ide-agent"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-jsonrpc",
|
||||
@@ -3992,7 +3992,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-analysis"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ast-grep-core",
|
||||
"ide-core",
|
||||
@@ -4006,7 +4006,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-build"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"dunce",
|
||||
@@ -4021,24 +4021,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-clipboard"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
|
||||
[[package]]
|
||||
name = "ide-core"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"specta",
|
||||
"specta-typescript",
|
||||
"thiserror 2.0.21",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ide-coverage"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4052,7 +4051,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-dap"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-jsonrpc",
|
||||
@@ -4069,7 +4068,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-db"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"futures",
|
||||
@@ -4088,7 +4087,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-docker"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"libc",
|
||||
@@ -4102,7 +4101,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-github"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-vcs",
|
||||
@@ -4116,7 +4115,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-host"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"dunce",
|
||||
@@ -4157,7 +4156,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-http"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4175,7 +4174,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-index"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4197,7 +4196,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jsonrpc"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"futures",
|
||||
@@ -4213,7 +4212,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-language"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4222,7 +4221,6 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"regex-lite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"specta",
|
||||
"toml 0.9.12+spec-1.1.0",
|
||||
"tracing",
|
||||
@@ -4267,7 +4265,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-lsp"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"globset",
|
||||
@@ -4290,7 +4288,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-plugin"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4308,7 +4306,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-profiler"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4321,7 +4319,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-remote"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"ide-core",
|
||||
@@ -4338,7 +4336,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-run"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"ide-core",
|
||||
@@ -4358,7 +4356,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-sdk"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"ide-core",
|
||||
@@ -4377,7 +4375,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-search"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"globset",
|
||||
@@ -4397,7 +4395,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-spell"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4410,7 +4408,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-ssh"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"flate2",
|
||||
@@ -4429,7 +4427,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-syntax"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4444,7 +4442,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-terminal"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"libc",
|
||||
@@ -4457,7 +4455,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-text"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4469,7 +4467,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-tools"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hex",
|
||||
@@ -4489,7 +4487,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vcs"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"gix",
|
||||
@@ -4506,7 +4504,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vfs"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"chardetng",
|
||||
"dunce",
|
||||
@@ -4527,7 +4525,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-web"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"open",
|
||||
@@ -4543,7 +4541,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-workspace"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -5968,7 +5966,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openidea"
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dirs 6.0.0",
|
||||
|
||||
@@ -3,7 +3,7 @@ resolver = "3"
|
||||
members = ["crates/*", "src-tauri"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.21"
|
||||
version = "0.1.18"
|
||||
edition = "2024"
|
||||
rust-version = "1.96"
|
||||
license = "Apache-2.0"
|
||||
@@ -46,7 +46,6 @@ serde_json = "1"
|
||||
toml = "0.9"
|
||||
toml_edit = "0.25"
|
||||
specta = { version = "=2.0.0-rc.25", features = ["derive"] }
|
||||
specta-typescript = "0.0.12"
|
||||
|
||||
# async & concurrency
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "process", "io-util", "fs"] }
|
||||
@@ -108,7 +107,5 @@ opt-level = 2
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = 3
|
||||
# Unwind, so a panic fails one task or command instead of quitting the IDE.
|
||||
panic = "unwind"
|
||||
# Keep the symbol table: crash reports and logged backtraces name functions.
|
||||
strip = "debuginfo"
|
||||
panic = "abort"
|
||||
strip = true
|
||||
@@ -6,10 +6,6 @@ contributors as part of the IntelliJ Platform (https://github.com/JetBrains/inte
|
||||
https://github.com/JetBrains/intellij-plugins), licensed under the Apache License 2.0.
|
||||
Copyright 2000-2026 JetBrains s.r.o. and contributors.
|
||||
|
||||
Some Simplified Chinese UI terms follow the Visual Studio Code Simplified Chinese
|
||||
language pack (https://github.com/microsoft/vscode-loc), Copyright (c) Microsoft
|
||||
Corporation, licensed under the MIT License.
|
||||
|
||||
OpenIDEA is not affiliated with, endorsed by or sponsored by JetBrains s.r.o.
|
||||
IntelliJ and IntelliJ IDEA are trademarks of JetBrains s.r.o.
|
||||
|
||||
|
||||
@@ -79,25 +79,15 @@ user's app-data directory only when the user asks; none of them ships with OpenI
|
||||
unmodified, and its source is available from the repository above.
|
||||
- **Eclipse JDT Language Server** (jdtls): EPL-2.0, from download.eclipse.org.
|
||||
|
||||
## en_US / en_GB Hunspell dictionaries
|
||||
## en_US Hunspell dictionary
|
||||
|
||||
`crates/ide-spell/src/dict/en_US.{aff,dic}` (the spell checker's bundled dictionary) is the
|
||||
SCOWL-derived en_US Hunspell dictionary (version 2020.12.07, from the `dictionary-en` npm
|
||||
package 4.0.0), copied unmodified. Copyright Kevin Atkinson and the SCOWL / Hunspell
|
||||
dictionary contributors; MIT- and BSD-style licences, full text in
|
||||
`crates/ide-spell/src/dict/LICENSE-en_US`. `crates/ide-spell/src/dict/en_GB-extra.dic` holds the
|
||||
entries of the matching en_GB dictionary (`dictionary-en-gb` npm package 3.0.0, same SCOWL
|
||||
version, licence and affix file) that en_US lacks. They are checked with the
|
||||
`crates/ide-spell/src/dict/LICENSE-en_US`. It is checked with the
|
||||
[spellbook](https://github.com/helix-editor/spellbook) crate (MPL-2.0).
|
||||
|
||||
## cspell-dicts word lists
|
||||
|
||||
`crates/ide-spell/src/dict/cspell-terms.txt` (programming terms the spell checker accepts)
|
||||
is derived from the software-terms, typescript, node, rust, fullstack, golang, java, cpp,
|
||||
shell and css dictionaries of [cspell-dicts](https://github.com/streetsidesoftware/cspell-dicts)
|
||||
(October 2026): lowercased, filtered and merged by OpenIDEA. Copyright Street Side Software;
|
||||
MIT licence, full text in `crates/ide-spell/src/dict/LICENSE-cspell-dicts`.
|
||||
|
||||
## nvim-treesitter queries
|
||||
|
||||
`crates/ide-syntax/queries/<grammar>/locals.scm` are derived from the `locals.scm`
|
||||
@@ -250,42 +240,3 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
|
||||
|
||||
## Chinese UI terminology from Visual Studio Code
|
||||
|
||||
Some Simplified Chinese terms in `src/platform/locales/text/zh.json` follow the
|
||||
wording of the Visual Studio Code Simplified Chinese language pack
|
||||
([microsoft/vscode-loc](https://github.com/microsoft/vscode-loc), MIT), e.g.
|
||||
"未跟踪" (untracked), "合并冲突" (merge conflicts), "当前" (current), "已修改"
|
||||
(modified), "已过时" (outdated), "中止" (abort), "正在卸载" (uninstalling),
|
||||
"深色" / "浅色" (dark / light) and "只读" (read-only). The remaining translations
|
||||
are written for this project.
|
||||
|
||||
```
|
||||
Visual Studio Code Localization Packs
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
```
|
||||
@@ -104,10 +104,17 @@ pub(crate) fn commands_of(update: &Value) -> Vec<AgentCommand> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `usage_update`: `{ used, size }`.
|
||||
/// `usage_update`: `{ used, size, cost?: { amount, currency } }`.
|
||||
pub(crate) fn usage_of(update: &Value) -> Option<AgentUsage> {
|
||||
let tokens = |key: &str| update.get(key)?.as_f64().map(|n| n.clamp(0.0, f64::from(u32::MAX)) as u32);
|
||||
Some(AgentUsage { used: tokens("used")?, size: tokens("size").filter(|s| *s > 0)? })
|
||||
let used = tokens("used")?;
|
||||
let size = tokens("size").filter(|s| *s > 0)?;
|
||||
Some(AgentUsage {
|
||||
used,
|
||||
size,
|
||||
cost: update.pointer("/cost/amount").and_then(Value::as_f64),
|
||||
currency: update.pointer("/cost/currency").and_then(Value::as_str).map(str::to_owned),
|
||||
})
|
||||
}
|
||||
|
||||
fn legacy(
|
||||
@@ -211,7 +218,7 @@ mod tests {
|
||||
assert_eq!(cmds[0].hint.as_deref(), Some("what to review"));
|
||||
assert_eq!((cmds[1].name.as_str(), cmds[1].hint.as_ref()), ("init", None));
|
||||
let u = usage_of(&json!({"used": 1200, "size": 200000, "cost": {"amount": 0.42, "currency": "USD"}})).unwrap();
|
||||
assert_eq!((u.used, u.size), (1200, 200000));
|
||||
assert_eq!((u.used, u.cost, u.currency.as_deref()), (1200, Some(0.42), Some("USD")));
|
||||
assert!(usage_of(&json!({"used": 1, "size": 0})).is_none());
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ struct Task {
|
||||
dirty: Mutex<BTreeSet<usize>>,
|
||||
flush_scheduled: AtomicBool,
|
||||
stderr: Mutex<VecDeque<String>>,
|
||||
/// Set by `delete`; held while saving.
|
||||
/// Set by `delete`; held while saving, so a late save can't bring the file back.
|
||||
deleted: Mutex<bool>,
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ impl AgentManager {
|
||||
if matches!(f.task.status, AgentStatus::Running | AgentStatus::NeedsInput | AgentStatus::Starting) {
|
||||
f.task.status = AgentStatus::Ready;
|
||||
let mut timeline = Timeline::from_entries(std::mem::take(&mut f.entries));
|
||||
timeline.end_turn(None);
|
||||
timeline.end_turn();
|
||||
f.entries = timeline.entries;
|
||||
}
|
||||
let task = Task::restore(f, shared.clone());
|
||||
@@ -577,13 +577,7 @@ impl Task {
|
||||
|
||||
fn cwd_and_base(&self) -> (PathBuf, String) {
|
||||
let s = self.state.lock();
|
||||
// In the project's own checkout the user commits too: compare against the current HEAD,
|
||||
// as the Commit tool window does, so commits made since the task started drop out.
|
||||
let base = match s.task.isolation {
|
||||
Isolation::Local => None,
|
||||
Isolation::Worktree => s.task.base_commit.clone(),
|
||||
};
|
||||
(s.task.cwd.0.clone(), base.unwrap_or_else(|| "HEAD".into()))
|
||||
(s.task.cwd.0.clone(), s.task.base_commit.clone().unwrap_or_else(|| "HEAD".into()))
|
||||
}
|
||||
|
||||
fn emit_task(&self) {
|
||||
@@ -604,11 +598,6 @@ impl Task {
|
||||
}
|
||||
|
||||
fn persist(&self) {
|
||||
// Held from snapshot to rename, so saves land in order and none follows a delete.
|
||||
let deleted = self.deleted.lock();
|
||||
if *deleted {
|
||||
return;
|
||||
}
|
||||
let bytes = {
|
||||
let s = self.state.lock();
|
||||
serde_json::to_vec(&TaskFile {
|
||||
@@ -619,6 +608,10 @@ impl Task {
|
||||
})
|
||||
};
|
||||
let path = self.shared.paths.store_dir.join(format!("{}.json", self.id));
|
||||
let deleted = self.deleted.lock();
|
||||
if *deleted {
|
||||
return;
|
||||
}
|
||||
if let Err(e) = bytes.map_err(|e| e.to_string()).and_then(|b| write_file(&path, &b)) {
|
||||
tracing::warn!("saving agent task {}: {e}", self.id);
|
||||
}
|
||||
@@ -665,7 +658,7 @@ impl Task {
|
||||
loop {
|
||||
let result = self.turn(&prompt).await;
|
||||
tokio::time::sleep(TURN_GRACE).await;
|
||||
let changed = self.state.lock().timeline.end_turn(Some(now_ms()));
|
||||
let changed = self.state.lock().timeline.end_turn();
|
||||
self.mark_dirty(changed);
|
||||
let send_now = self.send_now.swap(false, Ordering::AcqRel);
|
||||
let next = {
|
||||
@@ -709,12 +702,7 @@ impl Task {
|
||||
.map(|f| file_name(&f.0))
|
||||
.chain(prompt.images.iter().map(|i| i.name.clone().unwrap_or_else(|| "image".into())))
|
||||
.collect();
|
||||
self.push_entry(AgentEntry::User {
|
||||
text: prompt.text.clone(),
|
||||
attachments,
|
||||
sent_ms: Some(now_ms()),
|
||||
done_ms: None,
|
||||
});
|
||||
self.push_entry(AgentEntry::User { text: prompt.text.clone(), attachments });
|
||||
// Launching the agent can take a while (`npx` fetches its adapter on first use).
|
||||
let starting = self.live.lock().as_ref().is_none_or(|l| l.peer.is_closed());
|
||||
self.set_status(if starting { AgentStatus::Starting } else { AgentStatus::Running }, None);
|
||||
@@ -882,16 +870,6 @@ impl Task {
|
||||
|
||||
fn on_update(self: &Arc<Self>, update: &Value) {
|
||||
let kind = update.get("sessionUpdate").and_then(Value::as_str).unwrap_or_default();
|
||||
if kind == "session_info_update" {
|
||||
// The agent's own title for the session replaces the first line of the prompt.
|
||||
let title = update.get("title").and_then(Value::as_str).map(str::trim).filter(|t| !t.is_empty());
|
||||
if let Some(title) = title {
|
||||
self.state.lock().task.title = title.to_owned();
|
||||
self.persist();
|
||||
self.emit_task();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Session state (also while `session/load` replays history).
|
||||
let provider = self.state.lock().task.provider.clone();
|
||||
let task_changed = {
|
||||
|
||||
@@ -44,7 +44,7 @@ pub struct AgentTask {
|
||||
pub branch: Option<String>,
|
||||
/// Branch (or revision) the worktree was created from.
|
||||
pub base: Option<String>,
|
||||
/// Commit the task's changes are compared against (worktree tasks; local ones use `HEAD`).
|
||||
/// Commit the task's changes are compared against.
|
||||
pub base_commit: Option<String>,
|
||||
/// Why the task failed, when it did.
|
||||
pub error: Option<String>,
|
||||
@@ -114,6 +114,9 @@ pub struct AgentUsage {
|
||||
pub used: u32,
|
||||
/// Size of the context window.
|
||||
pub size: u32,
|
||||
/// Session cost so far.
|
||||
pub cost: Option<f64>,
|
||||
pub currency: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
@@ -191,12 +194,6 @@ pub enum AgentEntry {
|
||||
text: String,
|
||||
/// Names of the files and images sent with it.
|
||||
attachments: Vec<String>,
|
||||
/// When it was sent (ms since the epoch); `None` in tasks saved before this was kept.
|
||||
#[serde(default)]
|
||||
sent_ms: Option<f64>,
|
||||
/// When the turn it started ended; `None` while it runs or when it was cut off.
|
||||
#[serde(default)]
|
||||
done_ms: Option<f64>,
|
||||
},
|
||||
Agent {
|
||||
text: String,
|
||||
|
||||
@@ -66,7 +66,6 @@ impl Handler for FakeAgent {
|
||||
"availableCommands": [{"name": "review", "description": "Review", "input": {"hint": "focus"}}]}),
|
||||
);
|
||||
self.update(&session, json!({"sessionUpdate": "usage_update", "used": 50, "size": 1000}));
|
||||
self.update(&session, json!({"sessionUpdate": "session_info_update", "title": "Lexer fix"}));
|
||||
self.say(&session, "Hi");
|
||||
self.update(
|
||||
&session,
|
||||
@@ -227,7 +226,6 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {
|
||||
assert_eq!((modes.via, modes.current.as_deref()), (AgentConfigVia::Mode, Some("ask")));
|
||||
assert_eq!(t.commands.iter().map(|c| c.name.as_str()).collect::<Vec<_>>(), ["review"]);
|
||||
assert_eq!(t.usage.as_ref().map(|u| (u.used, u.size)), Some((50, 1000)));
|
||||
assert_eq!(t.title, "Lexer fix", "the agent's title replaces the prompt's first line");
|
||||
}
|
||||
mgr.set_config(&task.id, "mode", "code".into()).await.unwrap();
|
||||
assert!(agent.calls.lock().contains(&"session/set_mode \"code\"".to_owned()));
|
||||
@@ -240,17 +238,10 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {
|
||||
events.iter().any(|e| matches!(e, AgentEvent::Task { task } if task.status == AgentStatus::NeedsInput))
|
||||
);
|
||||
let last_entry = events.iter().rev().find_map(|e| match e {
|
||||
AgentEvent::Entry { index, entry, .. } if !matches!(entry, AgentEntry::User { .. }) => {
|
||||
Some((*index, entry.clone()))
|
||||
}
|
||||
AgentEvent::Entry { index, entry, .. } => Some((*index, entry.clone())),
|
||||
_ => None,
|
||||
});
|
||||
assert_eq!(last_entry, Some((4, AgentEntry::Agent { text: "chose yes".into() })));
|
||||
// The turn's end is recorded on the message that started it.
|
||||
assert!(events.iter().any(|e| matches!(
|
||||
e,
|
||||
AgentEvent::Entry { index: 0, entry: AgentEntry::User { sent_ms: Some(_), done_ms: Some(_), .. }, .. }
|
||||
)));
|
||||
}
|
||||
let providers = mgr.providers();
|
||||
let claude = providers.iter().find(|p| p.id == "claude").unwrap();
|
||||
@@ -262,7 +253,6 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {
|
||||
let agent2 = Arc::new(FakeAgent::default());
|
||||
let mgr2 = manager(tmp.path(), agent2.clone());
|
||||
assert_eq!(mgr2.entries(&task.id).unwrap().len(), 5);
|
||||
assert_eq!(mgr2.task(&task.id).unwrap().state.lock().task.title, "Lexer fix");
|
||||
assert_eq!(mgr2.providers().iter().find(|p| p.id == "claude").unwrap().config.len(), 2);
|
||||
mgr2.prompt(&task.id, text("again"), false).await.unwrap();
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
|
||||
@@ -166,17 +166,11 @@ impl Timeline {
|
||||
}
|
||||
}
|
||||
|
||||
/// Settles what an ended turn left open: running tools and pending permissions,
|
||||
/// and records when the turn ended (`done`) on the message that started it.
|
||||
pub fn end_turn(&mut self, done: Option<f64>) -> Vec<usize> {
|
||||
/// Settles what an ended turn left open: running tools and pending permissions.
|
||||
pub fn end_turn(&mut self) -> Vec<usize> {
|
||||
let mut changed = Vec::new();
|
||||
let started = self.entries.iter().rposition(|e| matches!(e, AgentEntry::User { .. }));
|
||||
for (i, e) in self.entries.iter_mut().enumerate() {
|
||||
match e {
|
||||
AgentEntry::User { done_ms, .. } if Some(i) == started && done.is_some() && done_ms.is_none() => {
|
||||
*done_ms = done;
|
||||
changed.push(i);
|
||||
}
|
||||
AgentEntry::Tool { status, .. }
|
||||
if matches!(status, AgentToolStatus::Pending | AgentToolStatus::Running) =>
|
||||
{
|
||||
@@ -292,27 +286,12 @@ mod tests {
|
||||
assert_eq!(t.apply(&plan("completed")).changed, vec![0]);
|
||||
t.apply(&json!({"sessionUpdate": "tool_call", "toolCallId": "c", "title": "Run", "status": "in_progress"}));
|
||||
t.push(AgentEntry::Permission { id: 1, title: "Run?".into(), options: vec![], chosen: None });
|
||||
assert_eq!(t.end_turn(None), vec![2, 3]);
|
||||
assert_eq!(t.end_turn(), vec![2, 3]);
|
||||
let again = Timeline::from_entries(t.entries.clone());
|
||||
assert_eq!(again.plan, Some(0));
|
||||
assert_eq!(again.tools.get("c"), Some(&2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn end_turn_records_when_the_last_message_was_answered() {
|
||||
let user =
|
||||
|sent: f64| AgentEntry::User { text: "q".into(), attachments: vec![], sent_ms: Some(sent), done_ms: None };
|
||||
let mut t = Timeline::default();
|
||||
t.push(user(1.0));
|
||||
t.push(AgentEntry::Agent { text: "a".into() });
|
||||
t.push(user(2.0));
|
||||
assert_eq!(t.end_turn(Some(5.0)), vec![2]);
|
||||
assert!(matches!(t.entries[0], AgentEntry::User { done_ms: None, .. }));
|
||||
assert!(matches!(t.entries[2], AgentEntry::User { done_ms: Some(5.0), .. }));
|
||||
// Settled once: a later end (a restart) doesn't move it.
|
||||
assert_eq!(t.end_turn(Some(9.0)), Vec::<usize>::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn long_output_keeps_its_tail() {
|
||||
let s = tail("é".repeat(MAX_OUTPUT));
|
||||
|
||||
@@ -52,7 +52,7 @@ pub(crate) fn run(
|
||||
use std::os::unix::process::CommandExt;
|
||||
command.process_group(0);
|
||||
}
|
||||
ide_core::process::prepare(&mut command);
|
||||
ide_core::process::no_window(&mut command);
|
||||
let mut child = command.spawn().map_err(|e| IdeError::unavailable(format!("cannot start {program}: {e}")))?;
|
||||
let (tx, rx) = mpsc::channel::<(Stream, String)>();
|
||||
let pump = |stream: Box<dyn Read + Send>, kind: Stream, tx: mpsc::Sender<(Stream, String)>| {
|
||||
|
||||
@@ -10,6 +10,5 @@ dunce.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
specta.workspace = true
|
||||
specta-typescript.workspace = true
|
||||
thiserror.workspace = true
|
||||
tokio-util.workspace = true
|
||||
@@ -5,121 +5,22 @@ use std::process::Command;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
/// Windows `CREATE_NO_WINDOW` creation flag, for call sites that combine it
|
||||
/// with other flags (and then call [`host_env`] themselves). Prefer [`prepare`] otherwise.
|
||||
/// with other flags. Prefer [`no_window`] otherwise.
|
||||
pub const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
|
||||
/// Readies `cmd` for spawning any child (java, node, curl, git, a language server, ...).
|
||||
/// For a `tokio::process::Command`, pass `cmd.as_std_mut()`.
|
||||
///
|
||||
/// - Windows: release builds use the GUI subsystem, so without `CREATE_NO_WINDOW` every
|
||||
/// console child flashes a `cmd` window.
|
||||
/// - Linux AppImage: see [`host_env`].
|
||||
///
|
||||
/// Variables the call site has already set are kept; call it before `env_clear`.
|
||||
pub fn prepare(cmd: &mut Command) -> &mut Command {
|
||||
/// Keeps a console child (java, node, curl, a language server, ...) from
|
||||
/// opening its own console window on Windows. Release builds use the GUI
|
||||
/// subsystem, so without this every spawn flashes a `cmd` window. A no-op
|
||||
/// elsewhere. For a `tokio::process::Command`, pass `cmd.as_std_mut()`.
|
||||
pub fn no_window(cmd: &mut Command) -> &mut Command {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
cmd.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
host_env(cmd)
|
||||
}
|
||||
|
||||
/// Gives `cmd` the host's environment back when the IDE runs from an AppImage. `AppRun` and
|
||||
/// its hooks point `LD_LIBRARY_PATH`, `PATH`, `XDG_DATA_DIRS`, `GIO_MODULE_DIR`, `GTK_PATH`,
|
||||
/// `GST_PLUGIN_*`, ... into the mounted image for the IDE itself; a host program that
|
||||
/// inherits them loads the image's (older) libraries and plugins next to its own, e.g.
|
||||
/// `curl: symbol lookup error ... nghttp2_...`. The IDE process keeps its environment
|
||||
/// (WebKit and GTK still need it). Variables the call site has already set are kept.
|
||||
/// A no-op outside an AppImage.
|
||||
pub fn host_env(cmd: &mut Command) -> &mut Command {
|
||||
let fixes = appimage_fixes();
|
||||
if fixes.is_empty() {
|
||||
return cmd;
|
||||
}
|
||||
let explicit: Vec<OsString> = cmd.get_envs().map(|(k, _)| k.to_owned()).collect();
|
||||
for (key, value) in fixes.into_iter().filter(|(k, _)| !explicit.contains(k)) {
|
||||
match value {
|
||||
Some(v) => cmd.env(key, v),
|
||||
None => cmd.env_remove(key),
|
||||
};
|
||||
}
|
||||
cmd
|
||||
}
|
||||
|
||||
/// The [`host_env`] changes as `(name, value)` pairs, `None` meaning "remove", for spawners
|
||||
/// that are not a `std::process::Command` (a PTY `CommandBuilder`). Apply before the call
|
||||
/// site's own variables. Empty outside an AppImage.
|
||||
pub fn host_env_fixes() -> Vec<(OsString, Option<OsString>)> {
|
||||
appimage_fixes()
|
||||
}
|
||||
|
||||
/// This process's environment as a child should inherit it (see [`host_env`]), for call
|
||||
/// sites that build a child's environment from the IDE's own instead of inheriting it.
|
||||
pub fn host_vars() -> impl Iterator<Item = (OsString, OsString)> {
|
||||
let fixes = appimage_fixes();
|
||||
std::env::vars_os().filter_map(move |(k, v)| match fixes.iter().find(|(f, _)| *f == k) {
|
||||
Some((_, fixed)) => fixed.clone().map(|v| (k, v)),
|
||||
None => Some((k, v)),
|
||||
})
|
||||
}
|
||||
|
||||
/// [`std::env::var_os`] as a child should see it (see [`host_env`]).
|
||||
pub fn host_var_os(key: impl AsRef<OsStr>) -> Option<OsString> {
|
||||
let key = key.as_ref();
|
||||
match appimage_fixes().into_iter().find(|(k, _)| k == key) {
|
||||
Some((_, fixed)) => fixed,
|
||||
None => std::env::var_os(key),
|
||||
}
|
||||
}
|
||||
|
||||
/// Read on every call, not cached: startup rewrites `PATH` (login shell, managed tools).
|
||||
fn appimage_fixes() -> Vec<(OsString, Option<OsString>)> {
|
||||
if !cfg!(target_os = "linux") || std::env::var_os("APPDIR").is_none() {
|
||||
return Vec::new();
|
||||
}
|
||||
appimage_env_fixes(&std::env::vars_os().collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
/// Variables the AppImage runtime sets to describe the IDE's own launch.
|
||||
const APPIMAGE_LAUNCH_VARS: [&str; 4] = ["APPDIR", "APPIMAGE", "ARGV0", "OWD"];
|
||||
|
||||
/// What to change in `vars` (an environment) so a child sees the host's environment rather
|
||||
/// than the AppImage's: every `:`-separated entry inside `$APPDIR` is dropped (a saved
|
||||
/// `<NAME>_ORIG` wins when present), variables left empty are removed, and so are the
|
||||
/// runtime's own launch variables. Nothing changes when `APPDIR` is not set.
|
||||
fn appimage_env_fixes(vars: &[(OsString, OsString)]) -> Vec<(OsString, Option<OsString>)> {
|
||||
let get = |name: &str| vars.iter().find(|(k, _)| k == name).map(|(_, v)| v);
|
||||
let Some(appdir) =
|
||||
get("APPDIR").and_then(|v| v.to_str()).map(|v| v.trim_end_matches('/')).filter(|v| !v.is_empty())
|
||||
else {
|
||||
return Vec::new();
|
||||
};
|
||||
let inside = |entry: &str| entry.strip_prefix(appdir).is_some_and(|rest| rest.is_empty() || rest.starts_with('/'));
|
||||
let mut fixes = Vec::new();
|
||||
for (key, value) in vars {
|
||||
let (Some(name), Some(value)) = (key.to_str(), value.to_str()) else { continue };
|
||||
let fixed = if APPIMAGE_LAUNCH_VARS.contains(&name) {
|
||||
None
|
||||
} else if value.split(':').any(inside) {
|
||||
match get(&format!("{name}_ORIG")) {
|
||||
Some(orig) => Some(orig.clone()),
|
||||
None => {
|
||||
let kept: Vec<&str> = value.split(':').filter(|e| !e.is_empty() && !inside(e)).collect();
|
||||
Some(OsString::from(kept.join(":")))
|
||||
}
|
||||
}
|
||||
} else if name == "GTK_THEME" && value.is_empty() {
|
||||
// linuxdeploy-plugin-gtk exports `GTK_THEME="$APPIMAGE_GTK_THEME"`, usually empty.
|
||||
None
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
fixes.push((key.clone(), fixed.filter(|v| !v.is_empty())));
|
||||
}
|
||||
fixes
|
||||
}
|
||||
|
||||
static SHELL_ENV: OnceLock<Vec<(OsString, OsString)>> = OnceLock::new();
|
||||
|
||||
/// Records the login shell's environment, read once at startup off the main thread.
|
||||
@@ -149,108 +50,4 @@ mod tests {
|
||||
let vars: Vec<_> = shell_env().collect();
|
||||
assert_eq!(vars, [(OsStr::new("OPENIDEA_SHELL_ONLY_VAR"), OsStr::new("1"))]);
|
||||
}
|
||||
|
||||
fn env(pairs: &[(&str, &str)]) -> Vec<(OsString, OsString)> {
|
||||
pairs.iter().map(|(k, v)| (OsString::from(k), OsString::from(v))).collect()
|
||||
}
|
||||
|
||||
fn fixes(pairs: &[(&str, &str)]) -> Vec<(String, Option<String>)> {
|
||||
appimage_env_fixes(&env(pairs))
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k.into_string().unwrap(), v.map(|v| v.into_string().unwrap())))
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn fix(name: &str, value: Option<&str>) -> (String, Option<String>) {
|
||||
(name.to_owned(), value.map(str::to_owned))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appimage_entries_are_dropped_and_host_entries_kept() {
|
||||
let got = fixes(&[
|
||||
("APPDIR", "/tmp/.mount_OpenIDabc"),
|
||||
(
|
||||
"LD_LIBRARY_PATH",
|
||||
"/tmp/.mount_OpenIDabc/usr/lib/:/tmp/.mount_OpenIDabc/usr/lib/x86_64-linux-gnu/:/opt/cuda/lib64:/usr/local/lib",
|
||||
),
|
||||
("PATH", "/tmp/.mount_OpenIDabc/usr/bin/:/tmp/.mount_OpenIDabc/usr/sbin/:/usr/local/bin:/usr/bin"),
|
||||
("XDG_DATA_DIRS", "/tmp/.mount_OpenIDabc/usr/share:/usr/share:/usr/local/share:/usr/share"),
|
||||
("HOME", "/home/me"),
|
||||
("JAVA_HOME", "/tmp/.mount_OpenIDabcdef/jdk"),
|
||||
]);
|
||||
assert_eq!(
|
||||
got,
|
||||
[
|
||||
fix("APPDIR", None),
|
||||
fix("LD_LIBRARY_PATH", Some("/opt/cuda/lib64:/usr/local/lib")),
|
||||
fix("PATH", Some("/usr/local/bin:/usr/bin")),
|
||||
fix("XDG_DATA_DIRS", Some("/usr/share:/usr/local/share:/usr/share")),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn variables_left_empty_are_removed() {
|
||||
// AppRun prepends to an unset variable, leaving a trailing `:`; hooks set single paths.
|
||||
let got = fixes(&[
|
||||
("APPIMAGE", "/opt/openidea/OpenIDEA.AppImage"),
|
||||
("APPDIR", "/tmp/.mount_x/"),
|
||||
("ARGV0", "/opt/openidea/OpenIDEA.AppImage"),
|
||||
("OWD", "/home/me"),
|
||||
("LD_LIBRARY_PATH", "/tmp/.mount_x/usr/lib/:/tmp/.mount_x/lib/:"),
|
||||
("GIO_MODULE_DIR", "/tmp/.mount_x/usr/lib/gio/modules"),
|
||||
("GTK_DATA_PREFIX", "/tmp/.mount_x"),
|
||||
("GDK_PIXBUF_MODULE_FILE", "/tmp/.mount_x/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"),
|
||||
("GST_PLUGIN_SYSTEM_PATH_1_0", "/tmp/.mount_x/usr/lib/gstreamer-1.0"),
|
||||
("GTK_THEME", ""),
|
||||
]);
|
||||
let names: Vec<_> = got.iter().filter(|(_, v)| v.is_none()).map(|(k, _)| k.as_str()).collect();
|
||||
assert_eq!(
|
||||
names,
|
||||
[
|
||||
"APPIMAGE",
|
||||
"APPDIR",
|
||||
"ARGV0",
|
||||
"OWD",
|
||||
"LD_LIBRARY_PATH",
|
||||
"GIO_MODULE_DIR",
|
||||
"GTK_DATA_PREFIX",
|
||||
"GDK_PIXBUF_MODULE_FILE",
|
||||
"GST_PLUGIN_SYSTEM_PATH_1_0",
|
||||
"GTK_THEME",
|
||||
]
|
||||
);
|
||||
assert_eq!(names.len(), got.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_saved_original_value_wins() {
|
||||
let got = fixes(&[
|
||||
("APPDIR", "/tmp/.mount_x"),
|
||||
("LD_LIBRARY_PATH", "/tmp/.mount_x/usr/lib:/opt/lib"),
|
||||
("LD_LIBRARY_PATH_ORIG", "/opt/lib:/home/me/lib"),
|
||||
("PYTHONHOME", "/tmp/.mount_x/usr"),
|
||||
("PYTHONHOME_ORIG", ""),
|
||||
]);
|
||||
assert_eq!(
|
||||
got,
|
||||
[fix("APPDIR", None), fix("LD_LIBRARY_PATH", Some("/opt/lib:/home/me/lib")), fix("PYTHONHOME", None)]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outside_an_appimage_nothing_changes() {
|
||||
let plain = [("LD_LIBRARY_PATH", "/opt/lib:"), ("PATH", "/usr/bin"), ("GTK_THEME", "")];
|
||||
assert!(fixes(&plain).is_empty());
|
||||
assert!(fixes(&[("APPDIR", ""), ("PATH", "/usr/bin")]).is_empty());
|
||||
assert!(fixes(&[("APPDIR", "/"), ("PATH", "/usr/bin")]).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_env_keeps_what_the_call_site_set() {
|
||||
let mut cmd = Command::new("true");
|
||||
cmd.env("PATH", "/custom");
|
||||
prepare(&mut cmd);
|
||||
assert_eq!(cmd.get_envs().find(|(k, _)| *k == "PATH").and_then(|(_, v)| v), Some(OsStr::new("/custom")));
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,6 @@ pub struct Settings {
|
||||
/// Language servers / debug adapters at a user-chosen location, by the
|
||||
/// command the language definition launches (`elixir-ls`, `codelldb`).
|
||||
pub tools: BTreeMap<String, ToolSettings>,
|
||||
/// Per language server, by name (`rust-analyzer`): launch and protocol
|
||||
/// options on top of the language definition, or a server defined here.
|
||||
pub language_servers: BTreeMap<String, LanguageServerSettings>,
|
||||
/// Editor › Inspections profiles.
|
||||
pub inspections: InspectionSettings,
|
||||
/// Editor › Natural Languages › Spelling.
|
||||
@@ -64,58 +61,6 @@ pub struct ToolSettings {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
pub struct LanguageServerSettings {
|
||||
/// `false` keeps the server from starting for any language.
|
||||
pub enabled: bool,
|
||||
/// Executable to launch instead of the definition's; required for a server
|
||||
/// defined here (one with `languages`).
|
||||
pub command: String,
|
||||
/// Replaces the definition's arguments.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub args: Option<Vec<String>>,
|
||||
/// Added to the server's environment.
|
||||
pub env: BTreeMap<String, String>,
|
||||
/// Merged over the definition's `initializationOptions` (sent once at startup).
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional, type = Option<specta_typescript::Unknown>)]
|
||||
pub initialization_options: Option<serde_json::Value>,
|
||||
/// Answers the server's `workspace/configuration` requests; changes are pushed
|
||||
/// with `workspace/didChangeConfiguration` without a restart.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional, type = Option<specta_typescript::Unknown>)]
|
||||
pub settings: Option<serde_json::Value>,
|
||||
/// Language ids a server defined here serves (`python`); empty for the servers
|
||||
/// of the language definitions.
|
||||
pub languages: Vec<String>,
|
||||
/// Files marking a workspace root for a server defined here (`pyproject.toml`).
|
||||
pub root_markers: Vec<String>,
|
||||
}
|
||||
|
||||
impl Default for LanguageServerSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: true,
|
||||
command: String::new(),
|
||||
args: None,
|
||||
env: BTreeMap::new(),
|
||||
initialization_options: None,
|
||||
settings: None,
|
||||
languages: Vec::new(),
|
||||
root_markers: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LanguageServerSettings {
|
||||
/// A server defined in settings rather than by a language definition.
|
||||
pub fn is_custom(&self) -> bool {
|
||||
!self.languages.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
/// The configured executable for `command`, if any (`~/` not yet expanded).
|
||||
pub fn tool_path(&self, command: &str) -> Option<&str> {
|
||||
@@ -144,7 +89,6 @@ impl Default for Settings {
|
||||
actions_on_save: ActionsOnSaveSettings::default(),
|
||||
external_tools: Vec::new(),
|
||||
tools: BTreeMap::new(),
|
||||
language_servers: BTreeMap::new(),
|
||||
inspections: InspectionSettings::default(),
|
||||
spelling: SpellingSettings::default(),
|
||||
ssh: SshSettings::default(),
|
||||
@@ -330,7 +274,7 @@ impl Default for AppearanceSettings {
|
||||
ide_antialiasing: "greyscale".into(),
|
||||
editor_antialiasing: "greyscale".into(),
|
||||
show_tool_window_bars: true,
|
||||
show_tool_window_names: false,
|
||||
show_tool_window_names: true,
|
||||
widescreen_tool_windows: false,
|
||||
status_bar_widgets: BTreeMap::new(),
|
||||
main_toolbar: None,
|
||||
|
||||
@@ -206,7 +206,7 @@ pub fn collect(spec: &CoverageReportSpec) -> IdeResult<CoverageSuite> {
|
||||
CoverageReportSpec::Exported { runner, argv, cwd, env, lcov } => {
|
||||
let (program, args) =
|
||||
argv.split_first().ok_or_else(|| IdeError::invalid("empty coverage export command"))?;
|
||||
let out = ide_core::process::prepare(&mut Command::new(program))
|
||||
let out = ide_core::process::no_window(&mut Command::new(program))
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.envs(env)
|
||||
|
||||
@@ -257,7 +257,7 @@ pub async fn prepare_debugpy(spec: &mut AdapterSpec) -> IdeResult<()> {
|
||||
return Ok(()); // Reported as a missing adapter when it is started.
|
||||
};
|
||||
let mut probe = Command::new(&python);
|
||||
ide_core::process::prepare(probe.as_std_mut());
|
||||
ide_core::process::no_window(probe.as_std_mut());
|
||||
let probe = probe
|
||||
.args(["-c", "import debugpy.adapter"])
|
||||
.current_dir(&spec.cwd)
|
||||
@@ -396,7 +396,7 @@ impl AdapterLauncher for ProcessLauncher {
|
||||
None => args,
|
||||
};
|
||||
let mut cmd = Command::new(&binary);
|
||||
ide_core::process::prepare(cmd.as_std_mut());
|
||||
ide_core::process::no_window(cmd.as_std_mut());
|
||||
cmd.args(&args)
|
||||
.envs(spec.env.iter().map(|(k, v)| (k, v)))
|
||||
.current_dir(&spec.cwd)
|
||||
|
||||
@@ -170,7 +170,7 @@ pub fn is_go_binary(exe: &str) -> bool {
|
||||
pub fn list_processes() -> IdeResult<Vec<RawProcess>> {
|
||||
use std::collections::HashMap;
|
||||
let ps = |fields: &str| -> IdeResult<String> {
|
||||
let out = ide_core::process::prepare(&mut std::process::Command::new("ps"))
|
||||
let out = std::process::Command::new("ps")
|
||||
.args(["-x", "-ww", "-o", fields])
|
||||
.output()
|
||||
.map_err(|e| IdeError::unavailable(format!("cannot list processes: {e}")))?;
|
||||
@@ -212,9 +212,7 @@ pub const NODE_INSPECTOR_PORT: u16 = 9229;
|
||||
/// picker does) and waits until it listens. Returns the inspector port.
|
||||
#[cfg(unix)]
|
||||
pub async fn enable_node_inspector(pid: u32) -> IdeResult<u16> {
|
||||
let mut kill = tokio::process::Command::new("kill");
|
||||
ide_core::process::prepare(kill.as_std_mut());
|
||||
let status = kill
|
||||
let status = tokio::process::Command::new("kill")
|
||||
.args(["-USR1", &pid.to_string()])
|
||||
.status()
|
||||
.await
|
||||
|
||||
@@ -55,7 +55,7 @@ pub async fn build(
|
||||
) -> IdeResult<PathBuf> {
|
||||
let cargo = find_binary("cargo", cwd).ok_or_else(|| IdeError::unavailable("`cargo` not found on PATH"))?;
|
||||
let mut cmd = tokio::process::Command::new(cargo);
|
||||
ide_core::process::prepare(cmd.as_std_mut());
|
||||
ide_core::process::no_window(cmd.as_std_mut());
|
||||
cmd.args(args)
|
||||
.arg("--message-format=json-render-diagnostics")
|
||||
.current_dir(cwd)
|
||||
|
||||
@@ -421,7 +421,7 @@ pub(crate) fn run_in_terminal(s: &Arc<Session>, args: &Value) -> Result<Value, S
|
||||
return Err("runInTerminal without args".into());
|
||||
};
|
||||
let mut cmd = tokio::process::Command::new(program);
|
||||
ide_core::process::prepare(cmd.as_std_mut());
|
||||
ide_core::process::no_window(cmd.as_std_mut());
|
||||
cmd.args(rest)
|
||||
.envs(ide_core::process::shell_env())
|
||||
.stdin(Stdio::null())
|
||||
|
||||
@@ -69,7 +69,7 @@ pub fn docker_executable() -> Option<PathBuf> {
|
||||
pub fn run_env(ep: &DockerEndpoint) -> std::collections::BTreeMap<String, String> {
|
||||
let mut env = ep.env_vars();
|
||||
if let Some(dir) = docker_executable().as_deref().and_then(Path::parent) {
|
||||
let current = ide_core::process::host_var_os("PATH").unwrap_or_default();
|
||||
let current = std::env::var_os("PATH").unwrap_or_default();
|
||||
let mut dirs: Vec<PathBuf> = vec![dir.to_path_buf()];
|
||||
dirs.extend(std::env::split_paths(¤t).filter(|d| d != dir));
|
||||
if let Ok(path) = std::env::join_paths(dirs) {
|
||||
|
||||
@@ -25,7 +25,7 @@ fn prepare(cmd: &mut Command) {
|
||||
use std::os::unix::process::CommandExt;
|
||||
cmd.process_group(0);
|
||||
}
|
||||
ide_core::process::prepare(cmd);
|
||||
ide_core::process::no_window(cmd);
|
||||
}
|
||||
|
||||
fn spawn(cmd: &mut Command) -> IdeResult<Child> {
|
||||
|
||||
@@ -25,7 +25,7 @@ fn prepare(cmd: &mut Command) {
|
||||
use std::os::unix::process::CommandExt;
|
||||
cmd.process_group(0);
|
||||
}
|
||||
ide_core::process::prepare(cmd);
|
||||
ide_core::process::no_window(cmd);
|
||||
}
|
||||
|
||||
fn spawn(cmd: &mut Command) -> IdeResult<Child> {
|
||||
|
||||
@@ -241,11 +241,6 @@ pub fn lsp_servers(host: &Host, window: &str) -> IdeResult<Vec<ServerInfo>> {
|
||||
Ok(host.project(window)?.lsp.servers())
|
||||
}
|
||||
|
||||
pub fn lsp_resend_diagnostics(host: &Host, window: &str) -> IdeResult<()> {
|
||||
host.project(window)?.lsp.resend_diagnostics();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn lsp_restart(host: &Host, window: &str, server: ServerId) -> IdeResult<()> {
|
||||
host.project(window)?.lsp.restart(server).await
|
||||
}
|
||||
@@ -354,7 +349,6 @@ pub(crate) fn register(d: &mut Dispatcher) {
|
||||
lsp_type_hierarchy(&c.host, &c.window, c.arg("doc")?, c.arg("pos")?, c.arg("direction")?).await
|
||||
});
|
||||
d.add("lsp_servers", |c| async move { lsp_servers(&c.host, &c.window) });
|
||||
d.add("lsp_resend_diagnostics", |c| async move { lsp_resend_diagnostics(&c.host, &c.window) });
|
||||
d.add("lsp_restart", |c| async move { lsp_restart(&c.host, &c.window, c.arg("server")?).await });
|
||||
d.add("apply_workspace_edit", |c| async move { apply_workspace_edit(&c.host, &c.window, c.arg("edit")?) });
|
||||
d.add("lsp_execute_command", |c| async move {
|
||||
|
||||
@@ -113,7 +113,7 @@ pub fn set_settings(
|
||||
host.ssh.set_configs(host.global_settings.effective().ssh.configs);
|
||||
}
|
||||
// A new interpreter / toolchain / server executable restarts the language servers it affects.
|
||||
if ["languages", "tools", "languageServers"].iter().any(|k| key == *k || key.starts_with(&format!("{k}."))) {
|
||||
if ["languages", "tools"].iter().any(|k| key == *k || key.starts_with(&format!("{k}."))) {
|
||||
for project in affected() {
|
||||
let lsp = project.lsp.clone();
|
||||
host.runtime.spawn(async move { lsp.reconfigure().await });
|
||||
|
||||
@@ -26,17 +26,6 @@ fn tools(host: &Host, window: &str) -> IdeResult<Tools> {
|
||||
Ok(Tools::new(&data).with_custom_paths(custom).with_found_paths(found.into_iter().collect()))
|
||||
}
|
||||
|
||||
/// The language definitions plus the servers defined in the window's settings.
|
||||
fn languages(host: &Host, window: &str) -> Vec<ide_language::LanguageConfig> {
|
||||
let settings = match host.project(window) {
|
||||
Ok(project) => project.settings.effective(),
|
||||
Err(_) => host.global_settings.effective(),
|
||||
};
|
||||
let mut langs = host.languages.all();
|
||||
ide_sdk::apply::with_custom_servers(&mut langs, &settings);
|
||||
langs
|
||||
}
|
||||
|
||||
fn join_err(e: impl std::fmt::Display) -> IdeError {
|
||||
IdeError::internal(e.to_string())
|
||||
}
|
||||
@@ -51,7 +40,7 @@ fn reconfigure_servers(host: &Host) {
|
||||
/// Status of every known language server / debug adapter and the languages using it.
|
||||
pub async fn tools_list(host: &Host, window: &str) -> IdeResult<Vec<ToolInfo>> {
|
||||
let tools = tools(host, window)?;
|
||||
let langs = languages(host, window);
|
||||
let langs = host.languages.all();
|
||||
tokio::task::spawn_blocking(move || tools.list(&langs)).await.map_err(join_err)
|
||||
}
|
||||
|
||||
@@ -65,7 +54,7 @@ pub async fn tools_install(
|
||||
on_event: Channel<InstallEvent>,
|
||||
) -> IdeResult<ToolInfo> {
|
||||
let tools = tools(host, window)?;
|
||||
let langs = languages(host, window);
|
||||
let langs = host.languages.all();
|
||||
let cancel = host.begin_request(request);
|
||||
let result = tokio::task::spawn_blocking(move || {
|
||||
tools.install(&name, &langs, &cancel, &|e| {
|
||||
@@ -85,7 +74,7 @@ pub async fn tools_install(
|
||||
/// Removes a tool the IDE installed.
|
||||
pub async fn tools_uninstall(host: &Host, window: &str, name: String) -> IdeResult<ToolInfo> {
|
||||
let tools = tools(host, window)?;
|
||||
let langs = languages(host, window);
|
||||
let langs = host.languages.all();
|
||||
let info = tokio::task::spawn_blocking(move || tools.uninstall(&name, &langs)).await.map_err(join_err)??;
|
||||
reconfigure_servers(host);
|
||||
Ok(info)
|
||||
|
||||
@@ -117,9 +117,7 @@ impl Host {
|
||||
let data_dir = self.data_dir.clone();
|
||||
lsp.set_config_hook(Box::new(move |cfg, server_root| {
|
||||
let effective = settings.effective();
|
||||
ide_sdk::apply::server_launch_overrides(cfg, &effective);
|
||||
ide_sdk::apply::configure_server(cfg, &root, server_root, &effective);
|
||||
ide_sdk::java::cap_java_home(cfg, &ide_sdk::java::installed_jdks());
|
||||
if cfg.name == "jdtls" {
|
||||
let bundles: Vec<PathBuf> =
|
||||
ide_tools::managed_bundle(&data_dir, "java-debug").into_iter().collect();
|
||||
@@ -151,13 +149,6 @@ impl Host {
|
||||
);
|
||||
ide_sdk::jdtls::launch_directly(cfg);
|
||||
}
|
||||
ide_sdk::apply::server_protocol_overrides(cfg, &effective);
|
||||
}));
|
||||
}
|
||||
{
|
||||
let settings = settings.clone();
|
||||
lsp.set_servers_hook(Box::new(move |language, defined| {
|
||||
ide_sdk::apply::language_servers(language.as_str(), defined, &settings.effective())
|
||||
}));
|
||||
}
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ fn read_login_env(timeout: std::time::Duration) -> Option<Vec<(OsString, OsStrin
|
||||
|
||||
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/zsh".into());
|
||||
const MARK: &str = "__OPENIDEA_ENV__";
|
||||
let mut child = ide_core::process::prepare(&mut Command::new(&shell))
|
||||
let mut child = Command::new(&shell)
|
||||
.args(["-ilc", &format!("printf '{MARK}'; /usr/bin/env -0; printf '{MARK}'")])
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
|
||||
@@ -355,7 +355,7 @@ impl Peer {
|
||||
) -> std::io::Result<Self> {
|
||||
use std::process::Stdio;
|
||||
let mut cmd = tokio::process::Command::new(command);
|
||||
ide_core::process::prepare(cmd.as_std_mut());
|
||||
ide_core::process::no_window(cmd.as_std_mut());
|
||||
cmd.args(args)
|
||||
.current_dir(cwd)
|
||||
.envs(ide_core::process::shell_env())
|
||||
|
||||
@@ -9,7 +9,6 @@ license.workspace = true
|
||||
ide-core.workspace = true
|
||||
ide-text.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
specta.workspace = true
|
||||
toml.workspace = true
|
||||
tree-sitter.workspace = true
|
||||
|
||||
@@ -72,10 +72,6 @@ pub struct LanguageServerConfig {
|
||||
/// JSON passed as `initializationOptions`.
|
||||
#[serde(default)]
|
||||
pub initialization_options: Option<toml::Value>,
|
||||
/// Answers `workspace/configuration`; without it the sections are looked up
|
||||
/// in `initialization_options`.
|
||||
#[serde(default)]
|
||||
pub settings: Option<serde_json::Value>,
|
||||
/// Human hint shown when the binary is missing.
|
||||
#[serde(default)]
|
||||
pub install_hint: Option<String>,
|
||||
@@ -91,10 +87,6 @@ pub struct LanguageServerConfig {
|
||||
/// basedpyright): only used while none of those is installed.
|
||||
#[serde(default)]
|
||||
pub fallback: bool,
|
||||
/// Newest Java release the server runs on (kotlin-language-server: 21). A
|
||||
/// newer `JAVA_HOME` is replaced by the newest installed JDK that fits.
|
||||
#[serde(default)]
|
||||
pub max_java: Option<u32>,
|
||||
/// Set by the settings hook when the server can't run here (jdtls without
|
||||
/// a JDK 21+); reported as the failure instead of launching it.
|
||||
#[serde(skip)]
|
||||
|
||||
@@ -79,24 +79,20 @@ fn is_name_leaf(kind: &str) -> bool {
|
||||
kind.contains("identifier") || kind == "name"
|
||||
}
|
||||
|
||||
/// Node kinds whose `name` field is a use, not a declaration.
|
||||
const USE_PARENTS: &[&str] =
|
||||
&["invocation", "call", "access", "scoped", "reference", "expression", "selector", "qualified", "use_", "import"];
|
||||
|
||||
/// Whether the identifier leaf under `cursor` is the name a declaration
|
||||
/// introduces (`fn name`, `let pattern`, `int *declarator`, parameters,
|
||||
/// `name = …` assignments) rather than a use of one.
|
||||
fn declares(cursor: &TreeCursor<'_>, node: &Node<'_>) -> bool {
|
||||
let parent = node.parent().map(|p| p.kind()).unwrap_or_default();
|
||||
// Paths and calls name what is declared elsewhere (`use a::b::name`, `a.name()`).
|
||||
let reference = ["scoped", "qualified", "invocation", "member_access", "use_", "import", "call"]
|
||||
.iter()
|
||||
.any(|k| parent.contains(k));
|
||||
match cursor.field_name() {
|
||||
// Uses name their target with a `name` field too: Java `s.substring()`,
|
||||
// C# `a.Name`, Rust `use a::b::name`.
|
||||
Some("name") => !USE_PARENTS.iter().any(|p| parent.contains(p)),
|
||||
Some("name") => !reference,
|
||||
Some("pattern" | "declarator") => true,
|
||||
Some("left") => parent.contains("assignment") || parent.contains("declarator"),
|
||||
// A parameter's name, not its type (`String text`).
|
||||
Some("type") => false,
|
||||
_ => parent.contains("parameter") && !node.kind().contains("type"),
|
||||
_ => parent.contains("parameter"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1320,13 +1320,4 @@ fn spelling_regions_cover_declared_names_only() {
|
||||
.map(|r| &rs[r.start..r.end])
|
||||
.collect();
|
||||
assert_eq!(names, ["run", "n"]);
|
||||
let java = "class Bird { String fly(String text) { return text.substring(1); } }\n";
|
||||
let names: Vec<&str> = syntax()
|
||||
.spelling_regions(&lang("java"), java)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.filter(|r| r.kind == SpellingKind::Name)
|
||||
.map(|r| &java[r.start..r.end])
|
||||
.collect();
|
||||
assert_eq!(names, ["Bird", "fly", "text"]);
|
||||
}
|
||||
@@ -125,18 +125,20 @@ impl ClientHandler {
|
||||
}
|
||||
|
||||
fn configuration(&self, params: &Value) -> Value {
|
||||
let options = all_settings(&self.server.effective_config());
|
||||
let options = self
|
||||
.server
|
||||
.effective_config()
|
||||
.initialization_options
|
||||
.as_ref()
|
||||
.and_then(|v| serde_json::to_value(v).ok())
|
||||
.unwrap_or(Value::Null);
|
||||
let items = params.get("items").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
Value::Array(
|
||||
items
|
||||
.iter()
|
||||
// vtsls asks for the whole configuration as section `""`.
|
||||
.map(|item| match item.get("section").and_then(Value::as_str).filter(|s| !s.is_empty()) {
|
||||
// The server's own section: its block under `settings` (basedpyright asks
|
||||
// `basedpyright` and `basedpyright.analysis`), else the options themselves.
|
||||
Some(section) if section == self.server.name => {
|
||||
options.get("settings").and_then(|s| s.get(section)).unwrap_or(&options).clone()
|
||||
}
|
||||
Some(section) if section == self.server.name => options.clone(),
|
||||
// Servers that take settings under `initializationOptions.settings`
|
||||
// (jdtls) ask for the same sections later.
|
||||
Some(section) => [&options, options.get("settings").unwrap_or(&Value::Null)]
|
||||
@@ -242,29 +244,3 @@ impl Handler for ClientHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What `workspace/configuration` sections are looked up in: the server's
|
||||
/// `initializationOptions` with its `settings` merged over them.
|
||||
pub(crate) fn all_settings(cfg: &ide_language::LanguageServerConfig) -> Value {
|
||||
let mut out = cfg.initialization_options.as_ref().and_then(|v| serde_json::to_value(v).ok()).unwrap_or(Value::Null);
|
||||
if let Some(settings) = &cfg.settings {
|
||||
merge(&mut out, settings.clone());
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn merge(base: &mut Value, layer: Value) {
|
||||
match (base, layer) {
|
||||
(Value::Object(base), Value::Object(layer)) => {
|
||||
for (k, v) in layer {
|
||||
match base.get_mut(&k) {
|
||||
Some(existing) => merge(existing, v),
|
||||
None => {
|
||||
base.insert(k, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(base, layer) => *base = layer,
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,8 @@ impl LspManager {
|
||||
/// run doesn't prompt to install every language it meets.
|
||||
pub fn serves_path(&self, path: &Path) -> bool {
|
||||
let lang = self.languages.detect(path, None);
|
||||
self.language_servers(&lang).iter().any(|ls| {
|
||||
let Some(config) = self.languages.get(&lang) else { return false };
|
||||
config.language_servers.iter().any(|ls| {
|
||||
let mut cfg = ls.clone();
|
||||
if let Some(hook) = self.config_hook.read().clone() {
|
||||
hook(&mut cfg, &self.project_root);
|
||||
|
||||
@@ -116,7 +116,7 @@ fn resolve_rustup_proxy(command: &str, binary: PathBuf) -> Option<PathBuf> {
|
||||
if !is_proxy || command.contains('/') {
|
||||
return Some(binary);
|
||||
}
|
||||
let works = ide_core::process::prepare(&mut std::process::Command::new(&binary))
|
||||
let works = ide_core::process::no_window(&mut std::process::Command::new(&binary))
|
||||
.arg("--version")
|
||||
.stdin(std::process::Stdio::null())
|
||||
.stdout(std::process::Stdio::null())
|
||||
@@ -190,7 +190,7 @@ fn login_shell_path() -> Option<OsString> {
|
||||
use std::time::{Duration, Instant};
|
||||
let shell = std::env::var_os("SHELL")?;
|
||||
const MARK: &str = "__OPENIDEA_PATH__";
|
||||
let mut child = ide_core::process::prepare(&mut Command::new(shell))
|
||||
let mut child = Command::new(shell)
|
||||
.args(["-l", "-c", &format!("printf '{MARK}%s{MARK}' \"$PATH\"")])
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
|
||||
@@ -56,12 +56,6 @@ use types::*;
|
||||
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
const COMPLETION_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
const LONG_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
|
||||
/// How long a server may take to answer `initialize`. Some import the whole
|
||||
/// build there (kotlin-lsp, jdtls on a large Gradle project) and need minutes
|
||||
/// on a cold start; the status shows "starting" meanwhile, and a crash still
|
||||
/// ends the wait at once.
|
||||
const INITIALIZE_TIMEOUT: Duration = Duration::from_secs(300);
|
||||
/// How long a request waits for a server that is still initializing.
|
||||
const START_WAIT: Duration = Duration::from_secs(10);
|
||||
/// File moves may start a server (jdtls takes a while to import).
|
||||
@@ -74,9 +68,6 @@ pub type ApplyEditHook = Arc<dyn Fn(WorkspaceEdit) -> bool + Send + Sync>;
|
||||
/// settings before each launch; receives the server's workspace root.
|
||||
pub type ConfigFn = dyn Fn(&mut LanguageServerConfig, &Path) + Send + Sync;
|
||||
pub type ConfigHook = Arc<ConfigFn>;
|
||||
/// The servers a language uses, from its definition's list (user settings
|
||||
/// disable some and add others).
|
||||
pub type ServersFn = dyn Fn(&LanguageId, &[LanguageServerConfig]) -> Vec<LanguageServerConfig> + Send + Sync;
|
||||
|
||||
struct Attached {
|
||||
server: Arc<Server>,
|
||||
@@ -155,7 +146,6 @@ pub struct LspManager {
|
||||
docs: Mutex<HashMap<DocId, DocState>>,
|
||||
apply_edit_hook: RwLock<Option<ApplyEditHook>>,
|
||||
config_hook: RwLock<Option<ConfigHook>>,
|
||||
servers_hook: RwLock<Option<Arc<ServersFn>>>,
|
||||
candidates_hook: RwLock<Option<Arc<CandidateFn>>>,
|
||||
shutting_down: AtomicBool,
|
||||
/// `window/showMessage` texts already surfaced; servers repeat them on every restart/reconfigure.
|
||||
@@ -274,7 +264,6 @@ impl LspManager {
|
||||
docs: Mutex::new(HashMap::new()),
|
||||
apply_edit_hook: RwLock::new(None),
|
||||
config_hook: RwLock::new(None),
|
||||
servers_hook: RwLock::new(None),
|
||||
candidates_hook: RwLock::new(None),
|
||||
shutting_down: AtomicBool::new(false),
|
||||
shown_messages: Mutex::new(HashSet::new()),
|
||||
@@ -308,9 +297,10 @@ impl LspManager {
|
||||
/// The servers serving `path`: every regular one, and each `fallback` one
|
||||
/// only while all servers listed before it are missing.
|
||||
fn servers_for(&self, language: &LanguageId, path: &Path) -> Vec<Arc<Server>> {
|
||||
let Some(cfg) = self.languages.get(language) else { return Vec::new() };
|
||||
let mut out = Vec::new();
|
||||
let mut available_before = false;
|
||||
for sc in &self.language_servers(language) {
|
||||
for sc in &cfg.language_servers {
|
||||
if sc.fallback && available_before {
|
||||
continue;
|
||||
}
|
||||
@@ -321,18 +311,8 @@ impl LspManager {
|
||||
out
|
||||
}
|
||||
|
||||
/// The definitions of the servers `language` uses.
|
||||
fn language_servers(&self, language: &LanguageId) -> Vec<LanguageServerConfig> {
|
||||
let Some(cfg) = self.languages.get(language) else { return Vec::new() };
|
||||
match self.servers_hook.read().clone() {
|
||||
Some(hook) => hook(language, &cfg.language_servers),
|
||||
None => cfg.language_servers,
|
||||
}
|
||||
}
|
||||
|
||||
/// A server turned out to be missing: attach the fallbacks it was hiding
|
||||
/// to the open documents (and start them). Also attaches servers newly
|
||||
/// enabled in settings.
|
||||
/// to the open documents (and start them).
|
||||
fn attach_fallbacks(&self) {
|
||||
let open: Vec<(DocId, LanguageId, PathBuf)> =
|
||||
self.docs.lock().iter().map(|(id, d)| (*id, d.language.clone(), d.path.clone())).collect();
|
||||
@@ -427,7 +407,7 @@ impl LspManager {
|
||||
};
|
||||
|
||||
let init = self.initialize_params(&server);
|
||||
let result = tokio::time::timeout(INITIALIZE_TIMEOUT, peer.request::<_, Value>("initialize", init, None))
|
||||
let result = tokio::time::timeout(Duration::from_secs(60), peer.request::<_, Value>("initialize", init, None))
|
||||
.await
|
||||
.unwrap_or(Err(RpcError::Timeout));
|
||||
let caps = match result {
|
||||
@@ -452,14 +432,6 @@ impl LspManager {
|
||||
if let Err(e) = peer.notify("initialized", json!({})) {
|
||||
tracing::warn!("{}: {e}", server.name);
|
||||
}
|
||||
// Servers that don't ask with `workspace/configuration` only learn settings this way.
|
||||
let cfg = server.effective_config();
|
||||
if cfg.settings.is_some()
|
||||
&& let Err(e) =
|
||||
peer.notify("workspace/didChangeConfiguration", json!({ "settings": handler::all_settings(&cfg) }))
|
||||
{
|
||||
tracing::debug!("{}: didChangeConfiguration: {e}", server.name);
|
||||
}
|
||||
let run = Running { generation, peer: peer.clone(), caps: Arc::new(RwLock::new(caps)) };
|
||||
|
||||
// Publish readiness and (re)open attached documents atomically w.r.t. did_change.
|
||||
@@ -1806,11 +1778,6 @@ impl LspManager {
|
||||
*self.config_hook.write() = Some(Arc::from(hook));
|
||||
}
|
||||
|
||||
/// Installed by `src-tauri` to apply the servers enabled / defined in settings.
|
||||
pub fn set_servers_hook(&self, hook: Box<ServersFn>) {
|
||||
*self.servers_hook.write() = Some(Arc::from(hook));
|
||||
}
|
||||
|
||||
/// The server's base configuration with the settings hook applied.
|
||||
fn configured(&self, server: &Server) -> LanguageServerConfig {
|
||||
let mut cfg = server.config.clone();
|
||||
@@ -1822,26 +1789,11 @@ impl LspManager {
|
||||
|
||||
/// Restarts running servers whose settings-derived configuration changed
|
||||
/// (e.g. a new project interpreter); stopped ones pick it up on their next start.
|
||||
/// A change of `settings` alone reaches a running server without a restart.
|
||||
/// Servers no longer enabled stop; newly enabled ones attach to open documents.
|
||||
pub async fn reconfigure(&self) {
|
||||
self.stop_unlisted().await;
|
||||
let servers: Vec<Arc<Server>> = self.servers.lock().clone();
|
||||
for s in servers {
|
||||
let next = self.configured(&s);
|
||||
let current = s.effective_config();
|
||||
if next == current {
|
||||
continue;
|
||||
}
|
||||
let without_settings = |c: &LanguageServerConfig| LanguageServerConfig { settings: None, ..c.clone() };
|
||||
if let Some(run) = s.running()
|
||||
&& without_settings(&next) == without_settings(¤t)
|
||||
{
|
||||
s.set_effective_config(next);
|
||||
let params = json!({ "settings": handler::all_settings(&s.effective_config()) });
|
||||
if let Err(e) = run.peer.notify("workspace/didChangeConfiguration", params) {
|
||||
tracing::debug!("{}: didChangeConfiguration: {e}", s.name);
|
||||
}
|
||||
if next == s.effective_config() {
|
||||
continue;
|
||||
}
|
||||
match s.status() {
|
||||
@@ -1863,120 +1815,12 @@ impl LspManager {
|
||||
ide_core::event::ServerStatus::Stopped => {}
|
||||
}
|
||||
}
|
||||
self.attach_fallbacks();
|
||||
self.detach_shadowed_fallbacks().await;
|
||||
}
|
||||
|
||||
/// A server enabled again shadows the fallbacks attached in its place: they
|
||||
/// leave the open documents, and stop once no document uses them.
|
||||
async fn detach_shadowed_fallbacks(&self) {
|
||||
let open: Vec<(DocId, LanguageId, PathBuf)> =
|
||||
self.docs.lock().iter().map(|(id, d)| (*id, d.language.clone(), d.path.clone())).collect();
|
||||
let mut shadowed: Vec<(DocId, Vec<ide_core::ServerId>)> = Vec::new();
|
||||
for (id, language, path) in open {
|
||||
let configs = self.language_servers(&language);
|
||||
let wanted = self.servers_for(&language, &path);
|
||||
let docs = self.docs.lock();
|
||||
let Some(d) = docs.get(&id) else { continue };
|
||||
let gone: Vec<ide_core::ServerId> = d
|
||||
.servers
|
||||
.iter()
|
||||
.filter(|a| {
|
||||
!wanted.iter().any(|w| w.id == a.server.id)
|
||||
&& configs.iter().any(|c| c.fallback && c.name == a.server.name)
|
||||
})
|
||||
.map(|a| a.server.id)
|
||||
.collect();
|
||||
if !gone.is_empty() {
|
||||
shadowed.push((id, gone));
|
||||
}
|
||||
}
|
||||
if shadowed.is_empty() {
|
||||
return;
|
||||
}
|
||||
let mut detached: Vec<Arc<Server>> = Vec::new();
|
||||
{
|
||||
let mut docs = self.docs.lock();
|
||||
for (id, gone) in shadowed {
|
||||
let Some(d) = docs.get_mut(&id) else { continue };
|
||||
let (leaving, staying): (Vec<Attached>, Vec<Attached>) =
|
||||
d.servers.drain(..).partition(|a| gone.contains(&a.server.id));
|
||||
d.servers = staying;
|
||||
for a in leaving {
|
||||
if let Some(run) = a.server.running()
|
||||
&& a.opened_gen == Some(run.generation)
|
||||
&& run.caps.read().open_close
|
||||
&& let Err(e) =
|
||||
run.peer.notify("textDocument/didClose", json!({ "textDocument": { "uri": d.uri } }))
|
||||
{
|
||||
tracing::debug!("{}: didClose: {e}", a.server.name);
|
||||
}
|
||||
self.sink.emit(ide_core::IdeEvent::Diagnostics {
|
||||
path: d.path.clone().into(),
|
||||
source: a.server.name.clone(),
|
||||
items: Vec::new(),
|
||||
});
|
||||
if !detached.iter().any(|s| s.id == a.server.id) {
|
||||
detached.push(a.server);
|
||||
}
|
||||
}
|
||||
}
|
||||
let in_use = |s: &Arc<Server>| docs.values().any(|d| d.servers.iter().any(|a| a.server.id == s.id));
|
||||
detached.retain(|s| !in_use(s));
|
||||
}
|
||||
if detached.is_empty() {
|
||||
return;
|
||||
}
|
||||
for s in &detached {
|
||||
tracing::info!("{}: shadowed by an enabled server, stopping", s.name);
|
||||
self.stop_instance(s, true).await;
|
||||
}
|
||||
self.servers.lock().retain(|s| !detached.iter().any(|d| d.id == s.id));
|
||||
}
|
||||
|
||||
/// Stops and forgets the servers that none of their languages uses any more.
|
||||
async fn stop_unlisted(&self) {
|
||||
let servers: Vec<Arc<Server>> = self.servers.lock().clone();
|
||||
let unlisted: Vec<Arc<Server>> = servers
|
||||
.into_iter()
|
||||
.filter(|s| !s.languages().iter().any(|l| self.language_servers(l).iter().any(|c| c.name == s.name)))
|
||||
.collect();
|
||||
if unlisted.is_empty() {
|
||||
return;
|
||||
}
|
||||
for s in &unlisted {
|
||||
tracing::info!("{}: no longer enabled, stopping", s.name);
|
||||
self.stop_instance(s, true).await;
|
||||
}
|
||||
let gone = |s: &Arc<Server>| unlisted.iter().any(|u| u.id == s.id);
|
||||
self.servers.lock().retain(|s| !gone(s));
|
||||
for d in self.docs.lock().values_mut() {
|
||||
d.servers.retain(|a| !gone(&a.server));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_apply_edit_hook(&self, hook: Box<dyn Fn(WorkspaceEdit) -> bool + Send + Sync>) {
|
||||
*self.apply_edit_hook.write() = Some(Arc::from(hook));
|
||||
}
|
||||
|
||||
/// Emits every server's current diagnostics again: a UI that (re)loaded
|
||||
/// after they were published has missed those events.
|
||||
pub fn resend_diagnostics(&self) {
|
||||
let servers: Vec<Arc<Server>> = self.servers.lock().clone();
|
||||
for server in servers {
|
||||
let encoding = server.running().map(|r| r.caps.read().encoding).unwrap_or_default();
|
||||
let conv = self.conv(encoding);
|
||||
for (path, items) in server.diagnostics_by_path() {
|
||||
let items = items.into_iter().map(|d| convert::diagnostic(&conv, &path, d, &server.name)).collect();
|
||||
self.sink.emit(ide_core::IdeEvent::Diagnostics {
|
||||
path: path.into(),
|
||||
source: server.name.clone(),
|
||||
items,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn servers(&self) -> Vec<ServerInfo> {
|
||||
self.servers
|
||||
.lock()
|
||||
|
||||
@@ -461,11 +461,6 @@ impl Server {
|
||||
d.iter().flat_map(|(p, items)| items.iter().map(move |i| (p.clone(), i.clone()))).collect()
|
||||
}
|
||||
|
||||
/// The current diagnostics of each file that has some.
|
||||
pub fn diagnostics_by_path(&self) -> Vec<(PathBuf, Vec<lsp::Diagnostic>)> {
|
||||
self.diagnostics.lock().iter().map(|(p, d)| (p.clone(), d.clone())).collect()
|
||||
}
|
||||
|
||||
pub fn take_diagnostic_paths(&self) -> Vec<PathBuf> {
|
||||
self.published.lock().clear();
|
||||
self.diagnostics.lock().drain().map(|(p, _)| p).collect()
|
||||
|
||||
@@ -94,7 +94,7 @@ pub(crate) fn connect_or_start(
|
||||
let args = substitute_args(&config.args, port, root);
|
||||
|
||||
let mut cmd = tokio::process::Command::new(binary);
|
||||
ide_core::process::prepare(cmd.as_std_mut());
|
||||
ide_core::process::no_window(cmd.as_std_mut());
|
||||
cmd.args(&args)
|
||||
.current_dir(root)
|
||||
.envs(env.iter().map(|(k, v)| (k.as_str(), v.as_str())))
|
||||
|
||||
@@ -203,11 +203,9 @@ fn server_cfg(name: &str) -> LanguageServerConfig {
|
||||
env: Default::default(),
|
||||
root_markers: vec!["mock.toml".into()],
|
||||
initialization_options: Some(toml::Value::Table(toml::toml! { flag = true nested = { deep = 1 } })),
|
||||
settings: None,
|
||||
install_hint: Some(format!("install {name}")),
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
}
|
||||
}
|
||||
@@ -523,15 +521,6 @@ async fn diagnostics_become_events_and_feed_code_actions() {
|
||||
assert_eq!(items[0].range, rng(0, 4, 0, 10));
|
||||
}
|
||||
|
||||
// A reloaded UI asks for them again.
|
||||
h.events.lock().clear();
|
||||
h.mgr.resend_diagnostics();
|
||||
let again = h.events.lock().iter().find_map(|e| match e {
|
||||
IdeEvent::Diagnostics { path, items, .. } => Some((path.clone(), items.len())),
|
||||
_ => None,
|
||||
});
|
||||
assert_eq!(again, Some((path.clone().into(), 2)));
|
||||
|
||||
s.respond(
|
||||
"textDocument/codeAction",
|
||||
json!([
|
||||
@@ -806,54 +795,6 @@ async fn launch_error_fails_without_starting_the_server() {
|
||||
assert!(!h.statuses("mock").contains(&ServerStatus::Crashed));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn settings_changes_reach_servers_without_restarts() {
|
||||
let h = harness(&[("mock", incremental_caps()), ("extra", incremental_caps())]);
|
||||
let settings: Arc<Mutex<Option<Value>>> = Default::default();
|
||||
let disabled: Arc<Mutex<Vec<String>>> = Default::default();
|
||||
{
|
||||
let settings = settings.clone();
|
||||
h.mgr.set_config_hook(Box::new(move |cfg, _| cfg.settings = settings.lock().clone()));
|
||||
}
|
||||
{
|
||||
let disabled = disabled.clone();
|
||||
h.mgr.set_servers_hook(Box::new(move |_, defined| {
|
||||
defined.iter().filter(|c| !disabled.lock().contains(&c.name)).cloned().collect()
|
||||
}));
|
||||
}
|
||||
h.open("a.mk", "x");
|
||||
h.wait_status("mock", ServerStatus::Ready).await;
|
||||
h.wait_status("extra", ServerStatus::Ready).await;
|
||||
|
||||
// Only `settings` changed: pushed to the running server, which keeps running.
|
||||
let s = h.launcher.state("mock");
|
||||
*settings.lock() = Some(json!({ "nested": { "other": 2 } }));
|
||||
h.mgr.reconfigure().await;
|
||||
eventually(|| !s.notified("workspace/didChangeConfiguration").is_empty()).await;
|
||||
assert_eq!(
|
||||
s.notified("workspace/didChangeConfiguration")[0],
|
||||
json!({ "settings": { "flag": true, "nested": { "deep": 1, "other": 2 } } })
|
||||
);
|
||||
assert_eq!(s.launches.load(Ordering::SeqCst), 1);
|
||||
let cfg: Value = s
|
||||
.peer()
|
||||
.request("workspace/configuration", json!({ "items": [{ "section": "nested.other" }] }), None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(cfg, json!([2]));
|
||||
|
||||
// Disabled: stopped and forgotten; enabled again: attached to the open document.
|
||||
disabled.lock().push("extra".into());
|
||||
h.mgr.reconfigure().await;
|
||||
assert_eq!(h.mgr.servers().iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["mock"]);
|
||||
assert_eq!(h.statuses("extra").last(), Some(&ServerStatus::Stopped));
|
||||
disabled.lock().clear();
|
||||
h.mgr.reconfigure().await;
|
||||
h.wait_status("extra", ServerStatus::Ready).await;
|
||||
eventually(|| h.launcher.state("extra").notified("textDocument/didOpen").len() == 2).await;
|
||||
assert_eq!(s.launches.load(Ordering::SeqCst), 1);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn fallback_servers_only_run_when_the_preferred_one_is_missing() {
|
||||
// Preferred installed: the alternative is never started.
|
||||
@@ -878,40 +819,6 @@ async fn fallback_servers_only_run_when_the_preferred_one_is_missing() {
|
||||
assert!(h.mgr.hover(doc, Pos::new(0, 0), Default::default()).await.is_ok());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_fallback_leaves_when_the_preferred_server_is_enabled_again() {
|
||||
let h = harness_with_fallbacks(&[("main", incremental_caps()), ("alt", incremental_caps())], &["alt"]);
|
||||
let disabled: Arc<Mutex<Vec<String>>> = Default::default();
|
||||
{
|
||||
let disabled = disabled.clone();
|
||||
h.mgr.set_servers_hook(Box::new(move |_, defined| {
|
||||
defined.iter().filter(|c| !disabled.lock().contains(&c.name)).cloned().collect()
|
||||
}));
|
||||
}
|
||||
let (doc, path) = h.open("a.mk", "x");
|
||||
let uri = uri_of(&path);
|
||||
h.wait_status("main", ServerStatus::Ready).await;
|
||||
assert!(h.statuses("alt").is_empty());
|
||||
|
||||
// Preferred disabled: the fallback takes over the open document.
|
||||
disabled.lock().push("main".into());
|
||||
h.mgr.reconfigure().await;
|
||||
h.wait_status("alt", ServerStatus::Ready).await;
|
||||
eventually(|| h.launcher.state("alt").docs.lock().contains_key(&uri)).await;
|
||||
assert_eq!(h.mgr.servers().iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["alt"]);
|
||||
|
||||
// Enabled again: the fallback closes the document and stops.
|
||||
disabled.lock().clear();
|
||||
h.mgr.reconfigure().await;
|
||||
h.wait_status("main", ServerStatus::Ready).await;
|
||||
eventually(|| h.launcher.state("main").docs.lock().contains_key(&uri)).await;
|
||||
assert!(!h.launcher.state("alt").notified("textDocument/didClose").is_empty());
|
||||
assert_eq!(h.statuses("alt").last(), Some(&ServerStatus::Stopped));
|
||||
assert_eq!(h.mgr.servers().iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["main"]);
|
||||
assert!(h.mgr.hover(doc, Pos::new(0, 0), Default::default()).await.is_ok());
|
||||
assert_eq!(h.launcher.state("alt").requested("textDocument/hover").len(), 0);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn implementations_per_position() {
|
||||
let caps = json!({ "textDocumentSync": 1, "implementationProvider": true });
|
||||
|
||||
@@ -70,11 +70,9 @@ async fn missing_binary_is_reported_with_install_hint() {
|
||||
env: Default::default(),
|
||||
root_markers: vec![],
|
||||
initialization_options: None,
|
||||
settings: None,
|
||||
install_hint: Some("npm i -g nope-ls".into()),
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
};
|
||||
let (mgr, events) = manager(dir.path(), LanguageRegistry::from_configs(vec![lang("nope", "nope", server)]));
|
||||
@@ -200,11 +198,9 @@ async fn typescript_language_server_end_to_end() {
|
||||
env: Default::default(),
|
||||
root_markers: vec!["tsconfig.json".into()],
|
||||
initialization_options: None,
|
||||
settings: None,
|
||||
install_hint: None,
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
};
|
||||
let (mgr, events) = manager(&root, LanguageRegistry::from_configs(vec![lang("typescript", "ts", server)]));
|
||||
@@ -244,11 +240,9 @@ fn npm_server(tools: &Path, name: &str, bin: &str, init: Option<serde_json::Valu
|
||||
env: Default::default(),
|
||||
root_markers: vec!["package.json".into()],
|
||||
initialization_options: init.map(|v| toml::Value::try_from(v).unwrap()),
|
||||
settings: None,
|
||||
install_hint: None,
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ pub fn collect(spec: &ProfileSpec) -> IdeResult<Profile> {
|
||||
if !data.is_file() {
|
||||
return Err(nothing_recorded("perf wrote no data"));
|
||||
}
|
||||
let out = ide_core::process::prepare(&mut Command::new(perf))
|
||||
let out = ide_core::process::no_window(&mut Command::new(perf))
|
||||
.args(["script", "-i"])
|
||||
.arg(data.as_ref() as &Path)
|
||||
.current_dir(cwd)
|
||||
|
||||
@@ -209,7 +209,7 @@ pub fn save_templates(root: &Path, templates: &[RunConfig]) -> IdeResult<()> {
|
||||
|
||||
/// The environment runs inherit (unless "Include system environment variables" is off).
|
||||
pub fn system_env() -> BTreeMap<String, String> {
|
||||
ide_core::process::host_vars().filter_map(|(k, v)| Some((k.into_string().ok()?, v.into_string().ok()?))).collect()
|
||||
std::env::vars().collect()
|
||||
}
|
||||
|
||||
/// Path of the user run configuration file for `root`.
|
||||
|
||||
@@ -407,12 +407,6 @@ impl ProcessManager {
|
||||
if env.clear {
|
||||
cmd.env_clear();
|
||||
} else {
|
||||
for (k, v) in ide_core::process::host_env_fixes() {
|
||||
match v {
|
||||
Some(v) => cmd.env(k, v),
|
||||
None => cmd.env_remove(k),
|
||||
}
|
||||
}
|
||||
for (k, v) in ide_core::process::shell_env() {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
@@ -608,7 +602,7 @@ fn launch_env(root: &Path, config: &RunConfig) -> IdeResult<LaunchEnv> {
|
||||
BTreeMap::new()
|
||||
} else {
|
||||
let base: BTreeMap<String, String> =
|
||||
if extras.include_system_env { crate::system_env() } else { BTreeMap::new() };
|
||||
if extras.include_system_env { std::env::vars().collect() } else { BTreeMap::new() };
|
||||
let paths: Vec<PathBuf> = extras.env_files.iter().map(|f| resolve_cwd(root, Some(Path::new(f)))).collect();
|
||||
crate::envfile::load(&paths, &base).map_err(|e| IdeError::not_found(format!("cannot read .env file: {e}")))?
|
||||
};
|
||||
@@ -626,7 +620,7 @@ fn apply_env(cmd: &mut Command, env: &LaunchEnv) {
|
||||
if env.clear {
|
||||
cmd.env_clear();
|
||||
} else {
|
||||
ide_core::process::host_env(cmd).envs(ide_core::process::shell_env());
|
||||
cmd.envs(ide_core::process::shell_env());
|
||||
}
|
||||
cmd.envs(&env.vars);
|
||||
}
|
||||
@@ -637,7 +631,6 @@ fn run_stop_command(stop: &StopCommand, output: &OutputFn) {
|
||||
output(OutputChunk::System { text: format!("{}\n", stop.line) });
|
||||
let inv = shell_invocation(&stop.line, cfg!(windows), std::env::var("COMSPEC").ok());
|
||||
let mut cmd = Command::new(&inv.program);
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
if inv.raw_args {
|
||||
add_raw_args(&mut cmd, &inv.args);
|
||||
} else {
|
||||
@@ -645,6 +638,7 @@ fn run_stop_command(stop: &StopCommand, output: &OutputFn) {
|
||||
}
|
||||
cmd.current_dir(&stop.cwd).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::piped());
|
||||
apply_env(&mut cmd, &stop.env);
|
||||
ide_core::process::no_window(&mut cmd);
|
||||
let mut child = match cmd.spawn() {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
|
||||
@@ -93,7 +93,7 @@ pub fn find_tool(name: &str, config: &RunConfig, dir: &Path, root: &Path) -> Opt
|
||||
pub fn probe(argv: &[String], dir: &Path, config: &RunConfig) -> bool {
|
||||
let Some((program, args)) = argv.split_first() else { return false };
|
||||
let program = resolve(program, config);
|
||||
ide_core::process::prepare(&mut Command::new(program))
|
||||
ide_core::process::no_window(&mut Command::new(program))
|
||||
.args(args)
|
||||
.current_dir(dir)
|
||||
.envs(&config.env)
|
||||
|
||||
@@ -5,8 +5,8 @@ use crate::discover::{project_venv_python, workspace_tsdk};
|
||||
use crate::exec::{path_with, search_path};
|
||||
use crate::{bin_dir, exe, venv_of};
|
||||
use crate::{godot, vue};
|
||||
use ide_core::settings::{LanguageServerSettings, Settings};
|
||||
use ide_language::{LanguageConfig, LanguageServerConfig};
|
||||
use ide_core::settings::Settings;
|
||||
use ide_language::LanguageServerConfig;
|
||||
use ide_run::RunConfig;
|
||||
use serde_json::{Value, json};
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -302,78 +302,6 @@ pub fn configure_server(cfg: &mut LanguageServerConfig, root: &Path, server_root
|
||||
}
|
||||
}
|
||||
|
||||
/// The servers `language` uses after Settings › Language Servers: the
|
||||
/// definition's ones that aren't disabled, then the ones defined in settings for it.
|
||||
pub fn language_servers(language: &str, defined: &[LanguageServerConfig], s: &Settings) -> Vec<LanguageServerConfig> {
|
||||
let enabled = |name: &str| s.language_servers.get(name).is_none_or(|ls| ls.enabled);
|
||||
let mut out: Vec<LanguageServerConfig> = defined.iter().filter(|c| enabled(&c.name)).cloned().collect();
|
||||
for (name, ls) in &s.language_servers {
|
||||
if ls.enabled && ls.languages.iter().any(|l| l == language) && !out.iter().any(|c| &c.name == name) {
|
||||
out.push(custom_server(name, ls));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Adds the servers defined in settings to the languages they serve (to list
|
||||
/// them with the tools); disabled ones stay so they can be turned back on.
|
||||
pub fn with_custom_servers(langs: &mut [LanguageConfig], s: &Settings) {
|
||||
for (name, ls) in s.language_servers.iter().filter(|(_, ls)| ls.is_custom()) {
|
||||
for lang in langs.iter_mut().filter(|l| ls.languages.iter().any(|id| id == l.id.as_str())) {
|
||||
if !lang.language_servers.iter().any(|c| &c.name == name) {
|
||||
lang.language_servers.push(custom_server(name, ls));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn custom_server(name: &str, ls: &LanguageServerSettings) -> LanguageServerConfig {
|
||||
LanguageServerConfig {
|
||||
name: name.to_owned(),
|
||||
command: ls.command.trim().to_owned(),
|
||||
args: Vec::new(),
|
||||
env: Default::default(),
|
||||
root_markers: ls.root_markers.clone(),
|
||||
initialization_options: None,
|
||||
settings: None,
|
||||
install_hint: Some(match ls.command.trim() {
|
||||
"" => format!("Set the command of `{name}` in Settings › Language Servers"),
|
||||
command => format!("`{command}` was not found: install it, or set its path in Settings › Language Servers"),
|
||||
}),
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Command and arguments from Settings › Language Servers; applied before
|
||||
/// [`configure_server`] so toolchain adjustments (a custom path, JVM args) still follow.
|
||||
pub fn server_launch_overrides(cfg: &mut LanguageServerConfig, s: &Settings) {
|
||||
let Some(ls) = s.language_servers.get(&cfg.name) else { return };
|
||||
if let Some(command) = non_empty(ls.command.trim()) {
|
||||
cfg.command = command.to_owned();
|
||||
}
|
||||
if let Some(args) = &ls.args {
|
||||
cfg.args = args.clone();
|
||||
}
|
||||
}
|
||||
|
||||
/// Environment, `initializationOptions` and `workspace/configuration` settings
|
||||
/// from Settings › Language Servers; applied last so they win over derived values.
|
||||
pub fn server_protocol_overrides(cfg: &mut LanguageServerConfig, s: &Settings) {
|
||||
let Some(ls) = s.language_servers.get(&cfg.name) else { return };
|
||||
cfg.env.extend(ls.env.iter().map(|(k, v)| (k.clone(), v.clone())));
|
||||
if let Some(options) = &ls.initialization_options {
|
||||
merge_init_options(cfg, options.clone());
|
||||
}
|
||||
if let Some(settings) = &ls.settings {
|
||||
let mut current = cfg.settings.take().filter(Value::is_object).unwrap_or_else(|| json!({}));
|
||||
merge(&mut current, settings.clone());
|
||||
cfg.settings = Some(current);
|
||||
}
|
||||
}
|
||||
|
||||
/// vue-language-server loads TypeScript as a library (`--tsdk`, else its own
|
||||
/// `require('typescript')`): the selected version, else its own, else the
|
||||
/// project's — whichever still has the language-service API.
|
||||
|
||||
@@ -59,7 +59,7 @@ pub(crate) fn query_in(
|
||||
if let Some(cwd) = cwd {
|
||||
cmd.current_dir(cwd);
|
||||
}
|
||||
let mut child = ide_core::process::prepare(&mut cmd)
|
||||
let mut child = ide_core::process::no_window(&mut cmd)
|
||||
.args(args)
|
||||
.env("PATH", search_path())
|
||||
.envs(env.iter().copied())
|
||||
@@ -112,7 +112,7 @@ pub(crate) fn stream(
|
||||
on_line: &dyn Fn(String),
|
||||
) -> IdeResult<String> {
|
||||
let mut cmd = Command::new(program);
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
ide_core::process::no_window(&mut cmd);
|
||||
cmd.args(args).env("PATH", search_path()).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
cmd.envs(env.iter().map(|(k, v)| (k, v)));
|
||||
if let Some(cwd) = cwd {
|
||||
|
||||
@@ -161,19 +161,6 @@ pub fn jdtls_jdks(min_java: u32) -> Arc<[Jdk]> {
|
||||
}
|
||||
}
|
||||
|
||||
/// For a server with `max-java`: when the `JAVA_HOME` it would get (its env,
|
||||
/// else the IDE's) is a newer JDK, points it at the newest of `jdks` that fits.
|
||||
pub fn cap_java_home(cfg: &mut LanguageServerConfig, jdks: &[Jdk]) {
|
||||
let Some(max) = cfg.max_java else { return };
|
||||
let current = cfg.env.get("JAVA_HOME").cloned().or_else(|| std::env::var("JAVA_HOME").ok());
|
||||
if current.as_deref().and_then(|h| jdk_at(Path::new(h))).is_some_and(|j| j.major <= max) {
|
||||
return;
|
||||
}
|
||||
if let Some(jdk) = jdks.iter().filter(|j| j.major <= max).max_by_key(|j| j.major) {
|
||||
cfg.env.insert("JAVA_HOME".into(), jdk.home.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
|
||||
/// Oldest Java version jdtls runs on when its install can't tell (its launcher's check).
|
||||
pub const JDTLS_MIN_JAVA: u32 = 21;
|
||||
|
||||
|
||||
@@ -28,11 +28,9 @@ fn server(name: &str) -> LanguageServerConfig {
|
||||
env: BTreeMap::new(),
|
||||
root_markers: vec![],
|
||||
initialization_options: None,
|
||||
settings: None,
|
||||
install_hint: None,
|
||||
connect: None,
|
||||
fallback: false,
|
||||
max_java: None,
|
||||
launch_error: None,
|
||||
}
|
||||
}
|
||||
@@ -207,59 +205,6 @@ fn project_jdk_and_maven_settings() {
|
||||
assert_eq!(project_jdk(tmp.path(), &s), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn language_server_settings_disable_add_and_override() {
|
||||
use crate::apply::{language_servers, server_launch_overrides, server_protocol_overrides, with_custom_servers};
|
||||
use ide_core::settings::LanguageServerSettings;
|
||||
use serde_json::json;
|
||||
|
||||
let mut s = Settings::default();
|
||||
s.language_servers.insert("pylsp".into(), LanguageServerSettings { enabled: false, ..Default::default() });
|
||||
s.language_servers.insert(
|
||||
"ruff".into(),
|
||||
LanguageServerSettings {
|
||||
command: "ruff".into(),
|
||||
args: Some(vec!["server".into()]),
|
||||
languages: vec!["python".into()],
|
||||
root_markers: vec!["pyproject.toml".into()],
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let defined = [server("basedpyright"), server("pylsp")];
|
||||
let names = |v: Vec<LanguageServerConfig>| v.into_iter().map(|c| c.name).collect::<Vec<_>>();
|
||||
assert_eq!(names(language_servers("python", &defined, &s)), ["basedpyright", "ruff"]);
|
||||
assert_eq!(names(language_servers("rust", &[server("rust-analyzer")], &s)), ["rust-analyzer"]);
|
||||
|
||||
// Listed with the tools even while disabled.
|
||||
let mut langs = ide_language::LanguageRegistry::load(None).unwrap().all();
|
||||
with_custom_servers(&mut langs, &s);
|
||||
let python = langs.iter().find(|l| l.id.as_str() == "python").unwrap();
|
||||
let mut ruff = python.language_servers.iter().find(|c| c.name == "ruff").unwrap().clone();
|
||||
assert_eq!(ruff.root_markers, ["pyproject.toml"]);
|
||||
server_launch_overrides(&mut ruff, &s);
|
||||
assert_eq!((ruff.command.as_str(), ruff.args.as_slice()), ("ruff", &["server".to_string()][..]));
|
||||
|
||||
s.language_servers.insert(
|
||||
"rust-analyzer".into(),
|
||||
LanguageServerSettings {
|
||||
env: BTreeMap::from([("RA_LOG".into(), "info".into())]),
|
||||
initialization_options: Some(json!({ "check": { "command": "clippy" } })),
|
||||
settings: Some(json!({ "rust-analyzer": { "cargo": { "features": "all" } } })),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let mut ra = server("rust-analyzer");
|
||||
ra.args = vec!["--stdio".into()];
|
||||
ra.initialization_options = Some(toml::Value::Table(toml::toml! { checkOnSave = false }));
|
||||
server_launch_overrides(&mut ra, &s);
|
||||
assert_eq!(ra.args, ["--stdio"], "no args setting keeps the definition's");
|
||||
server_protocol_overrides(&mut ra, &s);
|
||||
assert_eq!(ra.env["RA_LOG"], "info");
|
||||
let init = serde_json::to_value(ra.initialization_options.unwrap()).unwrap();
|
||||
assert_eq!(init, json!({ "checkOnSave": false, "check": { "command": "clippy" } }));
|
||||
assert_eq!(ra.settings, Some(json!({ "rust-analyzer": { "cargo": { "features": "all" } } })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn jdtls_jdk_setting() {
|
||||
if cfg!(windows) {
|
||||
@@ -599,29 +544,3 @@ fn vue_language_server_gets_a_typescript_with_the_language_service_api() {
|
||||
let lib = project.join("node_modules/typescript/lib");
|
||||
assert_eq!(cfg.args, [format!("--tsdk={}", lib.to_string_lossy())]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_java_picks_an_older_jdk() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let jdk = |major: u32| {
|
||||
let home = dir.path().join(format!("jdk-{major}"));
|
||||
std::fs::create_dir_all(home.join("bin")).unwrap();
|
||||
std::fs::write(home.join("release"), format!("JAVA_VERSION=\"{major}.0.1\"\n")).unwrap();
|
||||
std::fs::write(home.join("bin").join(exe("java")), "").unwrap();
|
||||
crate::java::jdk_at(&home).unwrap()
|
||||
};
|
||||
let (j17, j21, j25) = (jdk(17), jdk(21), jdk(25));
|
||||
let jdks = [j25.clone(), j21.clone(), j17];
|
||||
let mut cfg = LanguageServerConfig { max_java: Some(21), ..server("kotlin-language-server") };
|
||||
cfg.env.insert("JAVA_HOME".into(), j25.home.to_string_lossy().into_owned());
|
||||
crate::java::cap_java_home(&mut cfg, &jdks);
|
||||
assert_eq!(cfg.env["JAVA_HOME"], j21.home.to_string_lossy());
|
||||
|
||||
// A JAVA_HOME that fits, or no limit: left alone.
|
||||
crate::java::cap_java_home(&mut cfg, &[]);
|
||||
assert_eq!(cfg.env["JAVA_HOME"], j21.home.to_string_lossy());
|
||||
let mut free = server("other");
|
||||
free.env.insert("JAVA_HOME".into(), j25.home.to_string_lossy().into_owned());
|
||||
crate::java::cap_java_home(&mut free, &jdks);
|
||||
assert_eq!(free.env["JAVA_HOME"], j25.home.to_string_lossy());
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ide-spell"
|
||||
description = "Spell checking (Proofreading › Typo): word extraction from comments, strings and declared names, Hunspell en_US / en_GB dictionary, programming terms, user dictionaries"
|
||||
description = "Spell checking (Proofreading › Typo): word extraction from comments, strings and declared names, Hunspell en_US dictionary, user dictionaries"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2025 Street Side Software <[email protected]>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,246 +0,0 @@
|
||||
# Tool and file names, abbreviations and words common in code the other lists lack.
|
||||
# Accepted on their own, never as part of a compound (`conf` would pass `conflift`).
|
||||
# One lowercase word per line; checked case-insensitively.
|
||||
accel
|
||||
acked
|
||||
adoc
|
||||
adoptium
|
||||
allman
|
||||
askpass
|
||||
assignees
|
||||
avif
|
||||
basedpyright
|
||||
bytea
|
||||
canceller
|
||||
cand
|
||||
cands
|
||||
cjs
|
||||
closable
|
||||
clsx
|
||||
codelldb
|
||||
colima
|
||||
commitish
|
||||
condvar
|
||||
conf
|
||||
conftest
|
||||
conns
|
||||
cte
|
||||
ctes
|
||||
cts
|
||||
customizations
|
||||
dap
|
||||
ddl
|
||||
debuggee
|
||||
decapitalize
|
||||
deemphasize
|
||||
defmodule
|
||||
desync
|
||||
dialogs
|
||||
dic
|
||||
disassembler
|
||||
dists
|
||||
dlsym
|
||||
dlv
|
||||
dnd
|
||||
dup
|
||||
emmet
|
||||
envrc
|
||||
eslintrc
|
||||
expando
|
||||
exs
|
||||
fallbacks
|
||||
fixup
|
||||
fori
|
||||
gdscript
|
||||
gdshader
|
||||
gfm
|
||||
gitattributes
|
||||
gitoxide
|
||||
gix
|
||||
glyphs
|
||||
gomod
|
||||
gopath
|
||||
gopls
|
||||
goroot
|
||||
gpgsign
|
||||
gradle
|
||||
gradlew
|
||||
graphql
|
||||
guice
|
||||
hamcrest
|
||||
haspopup
|
||||
hcl
|
||||
hotswap
|
||||
htdocs
|
||||
hxx
|
||||
ideavimrc
|
||||
ime
|
||||
inflight
|
||||
inlines
|
||||
inplace
|
||||
integrations
|
||||
intelephense
|
||||
interp
|
||||
inv
|
||||
ipynb
|
||||
jacoco
|
||||
javac
|
||||
javaw
|
||||
javax
|
||||
jdt
|
||||
jdtls
|
||||
jdwp
|
||||
jenkinsfile
|
||||
jre
|
||||
jsdom
|
||||
jshell
|
||||
jsonl
|
||||
kapt
|
||||
kotlinc
|
||||
kts
|
||||
labelledby
|
||||
latencies
|
||||
lcov
|
||||
lemminx
|
||||
lexically
|
||||
lezer
|
||||
linkify
|
||||
lldb
|
||||
lockb
|
||||
logpoint
|
||||
logpoints
|
||||
lombok
|
||||
lossily
|
||||
lossy
|
||||
mapleader
|
||||
matview
|
||||
memmem
|
||||
menlo
|
||||
menuitemcheckbox
|
||||
mjs
|
||||
msvc
|
||||
mts
|
||||
mvn
|
||||
mvnw
|
||||
natively
|
||||
nextest
|
||||
nocapture
|
||||
nodelay
|
||||
nonmatching
|
||||
noopener
|
||||
noreferrer
|
||||
noremap
|
||||
notif
|
||||
notnull
|
||||
nvm
|
||||
ord
|
||||
osgi
|
||||
pathing
|
||||
pdm
|
||||
pipfile
|
||||
pred
|
||||
preds
|
||||
prunable
|
||||
psvm
|
||||
publickey
|
||||
pwa
|
||||
pyc
|
||||
pycache
|
||||
pyenv
|
||||
pyi
|
||||
pylsp
|
||||
pyvenv
|
||||
recency
|
||||
recents
|
||||
redb
|
||||
redecl
|
||||
reformats
|
||||
reinstalls
|
||||
rekey
|
||||
replit
|
||||
rerunnable
|
||||
rescan
|
||||
restorable
|
||||
retarget
|
||||
rfind
|
||||
rollup
|
||||
rsplit
|
||||
rsplitn
|
||||
rss
|
||||
rst
|
||||
runserver
|
||||
sbt
|
||||
scm
|
||||
sdkman
|
||||
segs
|
||||
sel
|
||||
severities
|
||||
shorthands
|
||||
sig
|
||||
sigil
|
||||
solarized
|
||||
sout
|
||||
specta
|
||||
splitn
|
||||
storable
|
||||
stty
|
||||
subclassed
|
||||
subsequence
|
||||
subsequences
|
||||
subtest
|
||||
subtests
|
||||
supabase
|
||||
sym
|
||||
syms
|
||||
taplo
|
||||
tauri
|
||||
tcpip
|
||||
tcsh
|
||||
temurin
|
||||
texlab
|
||||
tgz
|
||||
timescaledb
|
||||
timestamptz
|
||||
toks
|
||||
topo
|
||||
tpl
|
||||
tsdk
|
||||
tsv
|
||||
unclosed
|
||||
unformatted
|
||||
unlisten
|
||||
unmarking
|
||||
unmatch
|
||||
unminimize
|
||||
unqueue
|
||||
unshelve
|
||||
unsplit
|
||||
unsub
|
||||
unsubs
|
||||
untag
|
||||
untagged
|
||||
uptime
|
||||
vcs
|
||||
vendored
|
||||
vimrc
|
||||
visibilities
|
||||
vite
|
||||
vitest
|
||||
vmargs
|
||||
volar
|
||||
vsix
|
||||
vtsls
|
||||
wasi
|
||||
wasmtime
|
||||
webflux
|
||||
webmanifest
|
||||
wip
|
||||
xcrun
|
||||
xdebug
|
||||
zig
|
||||
zlogin
|
||||
zls
|
||||
zprofile
|
||||
zshenv
|
||||
zshrc
|
||||
zustand
|
||||
@@ -551,15 +551,3 @@ vulkan
|
||||
wgpu
|
||||
woff
|
||||
woff2
|
||||
breakpoint
|
||||
sku
|
||||
dropdown
|
||||
navbar
|
||||
superclass
|
||||
typedef
|
||||
eslint
|
||||
unittest
|
||||
jvm
|
||||
jdk
|
||||
ux
|
||||
endpoint
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Spell checking for IDEA's "Proofreading › Typo" inspection: words of
|
||||
//! comments, string literals and declared names (regions come from the
|
||||
//! syntax layer), checked against the bundled en_US / en_GB Hunspell dictionary, a
|
||||
//! syntax layer), checked against the bundled en_US Hunspell dictionary, a
|
||||
//! list of programming terms and the user's accepted words and dictionaries.
|
||||
//! Regular agent nouns of known words (`checkpointer`) pass everywhere; in
|
||||
//! identifiers so do closed compounds of known words (`codebase`).
|
||||
@@ -98,17 +98,12 @@ impl SpellScope {
|
||||
/// At most this many typos are reported per text.
|
||||
pub const MAX_TYPOS: usize = 2000;
|
||||
|
||||
/// The en_GB entries en_US lacks (`colour`, `behaviour`, `normalise`), in the
|
||||
/// same affix scheme: either spelling passes.
|
||||
const EN_GB_EXTRA: &str = include_str!("dict/en_GB-extra.dic");
|
||||
|
||||
/// The en_US dictionary plus [`EN_GB_EXTRA`].
|
||||
fn english() -> &'static spellbook::Dictionary {
|
||||
static DICT: OnceLock<spellbook::Dictionary> = OnceLock::new();
|
||||
DICT.get_or_init(|| {
|
||||
let aff = include_str!("dict/en_US.aff");
|
||||
let dic = format!("{}{EN_GB_EXTRA}", include_str!("dict/en_US.dic"));
|
||||
spellbook::Dictionary::new(aff, &dic).expect("bundled en dictionary parses")
|
||||
let dic = include_str!("dict/en_US.dic");
|
||||
spellbook::Dictionary::new(aff, dic).expect("bundled en_US dictionary parses")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -119,7 +114,6 @@ fn lemmas() -> &'static HashSet<&'static str> {
|
||||
include_str!("dict/en_US.dic")
|
||||
.lines()
|
||||
.skip(1)
|
||||
.chain(EN_GB_EXTRA.lines())
|
||||
.map(|l| l.split('/').next().unwrap_or(l).trim())
|
||||
.filter(|w| !w.is_empty() && w.chars().all(|c| c.is_ascii_lowercase()))
|
||||
.collect()
|
||||
@@ -142,12 +136,13 @@ fn doubles_final_consonant(stem: &str) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether dropping one letter or swapping two adjacent ones gives a `known`
|
||||
/// Whether dropping one letter or swapping two adjacent ones gives a dictionary
|
||||
/// word: then a compound (`writ`+`ting`) is more likely a typo of
|
||||
/// it (`writing`), as Hunspell's CHECKCOMPOUNDREP reasons.
|
||||
fn near_word(lower: &str, known: impl Fn(&str) -> bool) -> bool {
|
||||
fn near_word(lower: &str) -> bool {
|
||||
let b = lower.as_bytes();
|
||||
let check = |v: &[u8]| std::str::from_utf8(v).is_ok_and(&known);
|
||||
let dict = english();
|
||||
let check = |v: &[u8]| std::str::from_utf8(v).is_ok_and(|w| dict.check(w));
|
||||
(0..b.len()).any(|i| check(&[&b[..i], &b[i + 1..]].concat()))
|
||||
|| (0..b.len().saturating_sub(1)).any(|i| {
|
||||
let mut v = b.to_vec();
|
||||
@@ -156,43 +151,17 @@ fn near_word(lower: &str, known: impl Fn(&str) -> bool) -> bool {
|
||||
})
|
||||
}
|
||||
|
||||
fn term_list(text: &'static str) -> HashSet<&'static str> {
|
||||
text.lines().map(str::trim).filter(|l| !l.is_empty() && !l.starts_with('#')).collect()
|
||||
}
|
||||
|
||||
/// Hand-picked programming terms: short ones (`url`) may be part of a compound.
|
||||
fn curated_terms() -> &'static HashSet<&'static str> {
|
||||
static TERMS: OnceLock<HashSet<&'static str>> = OnceLock::new();
|
||||
TERMS.get_or_init(|| term_list(include_str!("dict/software.txt")))
|
||||
}
|
||||
|
||||
/// Imported programming terms, tool and library names, and abbreviations:
|
||||
/// never part of a compound.
|
||||
fn other_terms() -> &'static HashSet<&'static str> {
|
||||
fn software_terms() -> &'static HashSet<&'static str> {
|
||||
static TERMS: OnceLock<HashSet<&'static str>> = OnceLock::new();
|
||||
TERMS.get_or_init(|| {
|
||||
let mut terms = term_list(include_str!("dict/cspell-terms.txt"));
|
||||
terms.extend(term_list(include_str!("dict/code-words.txt")));
|
||||
terms
|
||||
include_str!("dict/software.txt")
|
||||
.lines()
|
||||
.map(str::trim)
|
||||
.filter(|l| !l.is_empty() && !l.starts_with('#'))
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
fn term(lower: &str) -> bool {
|
||||
curated_terms().contains(lower) || other_terms().contains(lower)
|
||||
}
|
||||
|
||||
/// A software term, or the plural of one Hunspell doesn't know (`endpoints`,
|
||||
/// `regexes`; not `filess`, `contextes`, `checkings`). [`other_terms`] need
|
||||
/// 4+ letters for that (`acses` stays flagged).
|
||||
fn software_term(lower: &str) -> bool {
|
||||
let plural_of = |w: &str| (curated_terms().contains(w) || w.len() >= MIN_PART && term(w)) && !english().check(w);
|
||||
term(lower)
|
||||
|| lower.strip_suffix('s').is_some_and(|w| !w.ends_with('s') && plural_of(w))
|
||||
|| lower
|
||||
.strip_suffix("es")
|
||||
.is_some_and(|w| ["s", "x", "z", "ch", "sh"].iter().any(|e| w.ends_with(e)) && plural_of(w))
|
||||
}
|
||||
|
||||
/// Words of a custom dictionary file: a plain word list or a Hunspell `.dic`
|
||||
/// (leading count line and `/FLAGS` ignored). Cached by modification time.
|
||||
fn dictionary_file(path: &Path) -> Arc<HashSet<String>> {
|
||||
@@ -247,15 +216,11 @@ impl Speller {
|
||||
|
||||
/// Whether `word` (of prose, a comment or a string) is spelt correctly.
|
||||
/// Case is forgiven the way identifiers need it: `url` passes for `URL`,
|
||||
/// `paris` for `Paris`. Possessives (`backend's`), regular agent nouns
|
||||
/// (`checkpointer`, `serializers`) and `-ed` / `-ing` / `-able` forms of
|
||||
/// programming terms (`stringified`) pass too.
|
||||
/// `paris` for `Paris`. Regular agent nouns of known words pass too
|
||||
/// (`checkpointer`, `serializers`).
|
||||
pub fn is_correct(&self, word: &str) -> bool {
|
||||
if let Some(base) = word.strip_suffix("'s") {
|
||||
return self.is_correct(base);
|
||||
}
|
||||
let lower = word.to_lowercase();
|
||||
self.listed(word, &lower) || self.agent_noun(&lower) || self.term_form(&lower)
|
||||
self.listed(word, &lower) || self.agent_noun(&lower)
|
||||
}
|
||||
|
||||
/// [`Self::is_correct`] for a part of an identifier, which may also be two
|
||||
@@ -265,7 +230,9 @@ impl Speller {
|
||||
}
|
||||
|
||||
fn user_word(&self, lower: &str) -> bool {
|
||||
self.accepted.contains(lower) || software_term(lower) || self.custom.iter().any(|d| d.contains(lower))
|
||||
self.accepted.contains(lower)
|
||||
|| software_terms().contains(lower)
|
||||
|| self.custom.iter().any(|d| d.contains(lower))
|
||||
}
|
||||
|
||||
/// In a dictionary, in any case style.
|
||||
@@ -288,63 +255,30 @@ impl Speller {
|
||||
let singular = lower.strip_suffix('s').unwrap_or(lower);
|
||||
let Some(before_r) = singular.strip_suffix('r') else { return false };
|
||||
let Some(before_er) = before_r.strip_suffix('e') else { return false };
|
||||
let mut stems = vec![before_r.to_string()];
|
||||
// (stem, root the `-or` noun would be built on)
|
||||
let mut stems = vec![(before_r.to_string(), before_er)];
|
||||
if let Some(y) = before_er.strip_suffix('i') {
|
||||
stems.push(format!("{y}y"));
|
||||
stems.push((format!("{y}y"), before_er));
|
||||
} else if !before_er.ends_with('e') && !doubles_final_consonant(before_er) {
|
||||
stems.push(before_er.to_string());
|
||||
stems.push((before_er.to_string(), before_er));
|
||||
}
|
||||
let or_noun = format!("{before_er}or");
|
||||
stems
|
||||
.into_iter()
|
||||
.any(|stem| stem.len() >= MIN_PART && (lemmas().contains(stem.as_str()) || self.term_stem(&stem)))
|
||||
&& !self.listed(&or_noun, &or_noun)
|
||||
}
|
||||
|
||||
/// A programming term or accepted word of 5+ letters Hunspell doesn't know
|
||||
/// (`stringify`; not `calls` or `calc`), to derive other words from.
|
||||
fn term_stem(&self, s: &str) -> bool {
|
||||
s.len() > MIN_PART && self.user_word(s) && !english().check(s)
|
||||
}
|
||||
|
||||
/// `<term>ed` / `<term>ing` / `<term>able` of a programming term or an
|
||||
/// accepted word of 5+ letters: `stringified` (stringify), `memoizing`
|
||||
/// (memoize), `upserted`. Dictionary words only take the endings Hunspell
|
||||
/// knows: `falled`, `quiting` stay flagged. Not when one letter off a known
|
||||
/// word (`preprocesssing`).
|
||||
fn term_form(&self, lower: &str) -> bool {
|
||||
if !lower.bytes().all(|c| c.is_ascii_lowercase()) {
|
||||
return false;
|
||||
}
|
||||
let stem = |s: &str| self.term_stem(s);
|
||||
let derived = ["ed", "ing", "able"].into_iter().any(|suffix| {
|
||||
let Some(root) = lower.strip_suffix(suffix) else { return false };
|
||||
let b = root.as_bytes();
|
||||
(stem(root) && !doubles_final_consonant(root))
|
||||
|| stem(&format!("{root}e"))
|
||||
|| (suffix != "ing" && root.strip_suffix('i').is_some_and(|y| stem(&format!("{y}y"))))
|
||||
|| (b.len() > 2 && b[b.len() - 1] == b[b.len() - 2] && stem(&root[..root.len() - 1]))
|
||||
});
|
||||
derived && !near_word(lower, |w| english().check(w) || self.user_word(w))
|
||||
stems.into_iter().any(|(stem, root)| {
|
||||
stem.len() >= MIN_PART
|
||||
&& (lemmas().contains(stem.as_str()) || self.user_word(&stem))
|
||||
&& !english().check(&format!("{root}or"))
|
||||
})
|
||||
}
|
||||
|
||||
/// Two known words run together, each at least [`MIN_PART`] letters (or a
|
||||
/// hand-picked or accepted 3-letter term: `urlpath`). Proper nouns and
|
||||
/// [`other_terms`] don't count (`guid` + `lines` would pass `guidlines`).
|
||||
/// 3-letter programming term: `urlpath`). Proper nouns don't count.
|
||||
fn compound(&self, lower: &str) -> bool {
|
||||
if lower.len() < 6 || !lower.bytes().all(|c| c.is_ascii_lowercase()) || NOT_COMPOUNDS.contains(&lower) {
|
||||
return false;
|
||||
}
|
||||
let known = |p: &str| {
|
||||
self.accepted.contains(p) || curated_terms().contains(p) || self.custom.iter().any(|d| d.contains(p))
|
||||
let part = |p: &str| {
|
||||
(p.len() >= 3 && self.user_word(p)) || (p.len() >= MIN_PART && (english().check(p) || self.agent_noun(p)))
|
||||
};
|
||||
let part = |p: &str| match p.len() {
|
||||
0..3 => false,
|
||||
3 => known(p),
|
||||
_ => known(p) || english().check(p) || self.agent_noun(p),
|
||||
};
|
||||
(3..=lower.len() - 3).any(|i| part(&lower[..i]) && part(&lower[i..]))
|
||||
&& !near_word(lower, |w| english().check(w))
|
||||
(3..=lower.len() - 3).any(|i| part(&lower[..i]) && part(&lower[i..])) && !near_word(lower)
|
||||
}
|
||||
|
||||
/// Replacements for `word`, best first, in the word's case style.
|
||||
@@ -361,15 +295,6 @@ impl Speller {
|
||||
out
|
||||
}
|
||||
|
||||
/// Whether the letter run `w` was split from is a known term as a whole:
|
||||
/// `IntelliJ` (`Intelli` + `J`), `PostgreSQL` (`Postgre` + `SQL`).
|
||||
fn known_run(&self, text: &str, w: &WordSpan) -> bool {
|
||||
let start =
|
||||
text[..w.start].char_indices().rev().find(|(_, c)| !c.is_alphabetic()).map_or(0, |(i, c)| i + c.len_utf8());
|
||||
let end = text[w.end..].find(|c: char| !c.is_alphabetic()).map_or(text.len(), |i| w.end + i);
|
||||
(start, end) != (w.start, w.end) && self.user_word(&text[start..end].to_lowercase())
|
||||
}
|
||||
|
||||
/// Misspelt words of `regions` (document order) in `text`; `None` when
|
||||
/// `cancelled` fires.
|
||||
pub fn check(&self, text: &str, regions: &[Region], cancelled: &dyn Fn() -> bool) -> Option<Vec<Typo>> {
|
||||
@@ -388,7 +313,7 @@ impl Speller {
|
||||
let ok = *verdicts
|
||||
.entry((word, name))
|
||||
.or_insert_with(|| if name { self.is_correct_identifier(word) } else { self.is_correct(word) });
|
||||
if !ok && !self.known_run(text, w) {
|
||||
if !ok {
|
||||
bad.push((*w, r.kind));
|
||||
}
|
||||
}
|
||||
@@ -505,14 +430,6 @@ mod tests {
|
||||
assert_eq!(typos[0].range, Range::new(Pos::new(0, 3), Pos::new(0, 10)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn misspellings_after_unicode_punctuation_do_not_panic() {
|
||||
let text = "// 状态:Recieve and 【mesage】 😀writting";
|
||||
let typos = Speller::default().check(text, &whole(text, RegionKind::Comment), &|| false).unwrap();
|
||||
let words: Vec<_> = typos.iter().map(|t| t.word.as_str()).collect();
|
||||
assert_eq!(words, ["Recieve", "mesage", "writting"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn identifiers_forgive_case_and_terms() {
|
||||
let s = Speller::default();
|
||||
@@ -522,53 +439,6 @@ mod tests {
|
||||
assert!(!s.is_correct("lenght"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn software_terms_and_their_plurals() {
|
||||
let s = Speller::default();
|
||||
for ok in ["breakpoint", "breakpoints", "endpoints", "datasets", "regexes"] {
|
||||
assert!(s.is_correct(ok), "{ok}");
|
||||
}
|
||||
for ok in
|
||||
["stringify", "instanceof", "keydown", "submenu", "truthy", "vitest", "gradle", "unstaged", "rebasing"]
|
||||
{
|
||||
assert!(s.is_correct(ok), "{ok}");
|
||||
}
|
||||
for bad in ["filess", "contextes", "checkings", "acses"] {
|
||||
assert!(!s.is_correct(bad), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn british_spellings() {
|
||||
let s = Speller::default();
|
||||
for ok in ["colour", "behaviours", "normalised", "centred", "analyse", "cancelled", "dialogs"] {
|
||||
assert!(s.is_correct(ok), "{ok}");
|
||||
}
|
||||
for bad in ["colur", "behavour", "normalsed"] {
|
||||
assert!(!s.is_correct(bad), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn split_terms_checked_whole() {
|
||||
let s = Speller::default();
|
||||
let text = "// Open IntelliJ or PostgreSQL, not Intelli alone";
|
||||
let words: Vec<_> =
|
||||
s.check(text, &whole(text, RegionKind::Comment), &|| false).unwrap().into_iter().map(|t| t.word).collect();
|
||||
assert_eq!(words, ["Intelli"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn possessives_and_term_forms() {
|
||||
let s = Speller::default();
|
||||
for ok in ["backend's", "commit's", "stringified", "memoizing", "upserted"] {
|
||||
assert!(s.is_correct(ok), "{ok}");
|
||||
}
|
||||
for bad in ["recieve's", "falled", "quiting", "preprocesssing", "perfer", "callser"] {
|
||||
assert!(!s.is_correct(bad), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn agent_nouns_of_known_words() {
|
||||
let s = Speller::default();
|
||||
@@ -587,7 +457,7 @@ mod tests {
|
||||
for ok in ["filepath", "dataframe", "username", "codebase", "pathname", "urlpath", "timestampfile"] {
|
||||
assert!(s.is_correct_identifier(ok), "{ok}");
|
||||
}
|
||||
assert!(!s.is_correct("timestampfile"));
|
||||
assert!(!s.is_correct("dataframe"));
|
||||
for bad in ["eachother", "everytime", "publically", "mesage", "lenght", "recieve", "comming", "withold"] {
|
||||
assert!(!s.is_correct_identifier(bad), "{bad}");
|
||||
}
|
||||
|
||||
@@ -97,12 +97,6 @@ impl TerminalManager {
|
||||
let mut cmd = CommandBuilder::new(&shell);
|
||||
cmd.args(&args);
|
||||
cmd.cwd(resolve_cwd(&options.cwd));
|
||||
for (k, v) in ide_core::process::host_env_fixes() {
|
||||
match v {
|
||||
Some(v) => cmd.env(k, v),
|
||||
None => cmd.env_remove(k),
|
||||
}
|
||||
}
|
||||
for (k, v) in env {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ fn extract_zip(archive: &Path, dest: &Path) -> IdeResult<()> {
|
||||
/// `.tar.xz` goes through the system `tar` (bsdtar on macOS/Windows, GNU tar + xz on Linux).
|
||||
fn extract_tar_xz(archive: &Path, dest: &Path) -> IdeResult<()> {
|
||||
let tar = which::which("tar").map_err(|_| IdeError::unavailable("`tar` is required to unpack .tar.xz archives"))?;
|
||||
let out = ide_core::process::prepare(&mut std::process::Command::new(tar))
|
||||
let out = ide_core::process::no_window(&mut std::process::Command::new(tar))
|
||||
.arg("-xJf")
|
||||
.arg(archive)
|
||||
.arg("-C")
|
||||
|
||||
@@ -72,10 +72,6 @@ pub struct ToolInfo {
|
||||
pub homepage: Option<String>,
|
||||
/// Why the executable chosen in settings cannot be used (status is then `Missing`).
|
||||
pub custom_error: Option<String>,
|
||||
/// A language server's arguments from its language definition.
|
||||
pub default_args: Vec<String>,
|
||||
/// A language server's `initializationOptions` from its language definition, as JSON text.
|
||||
pub default_initialization_options: Option<String>,
|
||||
}
|
||||
|
||||
/// Streamed install progress.
|
||||
@@ -165,7 +161,7 @@ pub fn extend_process_path(app_data: &Path) {
|
||||
/// `PATH` plus the usual per-user tool locations (GUI apps on macOS start with a minimal `PATH`).
|
||||
pub fn default_search_path() -> OsString {
|
||||
let mut dirs: Vec<PathBuf> =
|
||||
ide_core::process::host_var_os("PATH").map(|p| std::env::split_paths(&p).collect()).unwrap_or_default();
|
||||
std::env::var_os("PATH").map(|p| std::env::split_paths(&p).collect()).unwrap_or_default();
|
||||
if let Some(home) = std::env::var_os("HOME").or_else(|| std::env::var_os("USERPROFILE")).map(PathBuf::from) {
|
||||
for rel in [".cargo/bin", ".local/bin", "go/bin", ".bun/bin", ".volta/bin", ".npm-global/bin", "Library/pnpm"] {
|
||||
dirs.push(home.join(rel));
|
||||
@@ -213,8 +209,6 @@ struct Usage {
|
||||
command: Option<String>,
|
||||
kind: Option<ToolKind>,
|
||||
install_hint: Option<String>,
|
||||
args: Vec<String>,
|
||||
initialization_options: Option<String>,
|
||||
}
|
||||
|
||||
fn usages(langs: &[LanguageConfig]) -> BTreeMap<String, Usage> {
|
||||
@@ -249,14 +243,6 @@ fn usages(langs: &[LanguageConfig]) -> BTreeMap<String, Usage> {
|
||||
let languages = map.get(*host).map(|u| u.languages.clone()).unwrap_or_default();
|
||||
map.entry(plugin.to_string()).or_default().languages = languages;
|
||||
}
|
||||
// A server's defaults come from the first definition using it.
|
||||
for s in langs.iter().flat_map(|l| &l.language_servers).rev() {
|
||||
if let Some(u) = map.get_mut(&s.name) {
|
||||
u.args = s.args.clone();
|
||||
u.initialization_options =
|
||||
s.initialization_options.as_ref().and_then(|v| serde_json::to_value(v).ok()).map(|v| v.to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
@@ -343,7 +329,7 @@ impl Tools {
|
||||
|
||||
fn command(&self, program: impl AsRef<std::ffi::OsStr>) -> Command {
|
||||
let mut cmd = Command::new(program);
|
||||
ide_core::process::prepare(&mut cmd).env("PATH", &self.child_path);
|
||||
ide_core::process::no_window(&mut cmd).env("PATH", &self.child_path);
|
||||
cmd
|
||||
}
|
||||
|
||||
@@ -469,8 +455,6 @@ impl Tools {
|
||||
install_hint,
|
||||
homepage: None,
|
||||
custom_error: None,
|
||||
default_args: u.args.clone(),
|
||||
default_initialization_options: u.initialization_options.clone(),
|
||||
})
|
||||
.map(|info| self.apply_custom(info, None));
|
||||
};
|
||||
@@ -493,8 +477,6 @@ impl Tools {
|
||||
install_hint,
|
||||
homepage: Some(spec.homepage.to_string()),
|
||||
custom_error: None,
|
||||
default_args: usage.map(|u| u.args.clone()).unwrap_or_default(),
|
||||
default_initialization_options: usage.and_then(|u| u.initialization_options.clone()),
|
||||
})
|
||||
.map(|info| self.apply_custom(info, Some(spec)))
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ pub fn run_streamed(cmd: Command, cancel: &CancellationToken, emit: Emit) -> Ide
|
||||
/// Like [`run_streamed`] but returns `(success, output, status text)` instead of failing on a non-zero exit.
|
||||
pub fn run_collect(mut cmd: Command, cancel: &CancellationToken, emit: Emit) -> IdeResult<(bool, String, String)> {
|
||||
emit(InstallEvent::Line { text: format!("$ {}", describe(&cmd)) });
|
||||
ide_core::process::prepare(&mut cmd).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
ide_core::process::no_window(&mut cmd).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
let mut child = cmd.spawn().map_err(|e| IdeError::unavailable(format!("cannot run {}: {e}", describe(&cmd))))?;
|
||||
let (tx, rx) = mpsc::channel::<String>();
|
||||
let pipes: [Option<Box<dyn Read + Send>>; 2] = [
|
||||
@@ -94,7 +94,7 @@ pub fn run_collect(mut cmd: Command, cancel: &CancellationToken, emit: Emit) ->
|
||||
|
||||
/// Runs `cmd` to completion within `timeout`; returns (success, stdout + stderr).
|
||||
pub fn run_quiet(mut cmd: Command, timeout: Duration) -> Option<(bool, String)> {
|
||||
ide_core::process::prepare(&mut cmd).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
ide_core::process::no_window(&mut cmd).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
let mut child = cmd.spawn().ok()?;
|
||||
let mut stdout = child.stdout.take()?;
|
||||
let mut stderr = child.stderr.take()?;
|
||||
@@ -161,7 +161,7 @@ impl Http {
|
||||
|
||||
fn base(&self, url: &str) -> Command {
|
||||
let mut cmd = Command::new(&self.curl);
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
ide_core::process::no_window(&mut cmd);
|
||||
cmd.args(["-fsSL", "--retry", "2", "--connect-timeout", "20", "-A", "openidea"]);
|
||||
if url.starts_with("https://api.github.com/")
|
||||
&& let Ok(token) = std::env::var("GITHUB_TOKEN").or_else(|_| std::env::var("GH_TOKEN"))
|
||||
|
||||
@@ -72,7 +72,7 @@ pub fn git_version(executable: Option<&Path>) -> IdeResult<String> {
|
||||
};
|
||||
let mut cmd = Command::new(&exe);
|
||||
cmd.arg("--version").stdin(Stdio::null()).env("LC_ALL", "C");
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
ide_core::process::no_window(&mut cmd);
|
||||
let out = cmd.output().map_err(|e| IdeError::unavailable(format!("cannot run {}: {e}", exe.display())))?;
|
||||
let text = String::from_utf8_lossy(&out.stdout).trim().to_string();
|
||||
if !out.status.success() || !text.starts_with("git version") {
|
||||
@@ -106,7 +106,7 @@ pub(crate) fn command(root: &Path) -> IdeResult<Command> {
|
||||
for (k, v) in ASKPASS.read().unwrap_or_else(|e| e.into_inner()).iter() {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
ide_core::process::no_window(&mut cmd);
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
|
||||
@@ -96,46 +96,18 @@ pub fn open(url: &str, id: Option<&str>) -> IdeResult<()> {
|
||||
if !(url.starts_with("http://") || url.starts_with("https://") || url.starts_with("file://")) {
|
||||
return Err(IdeError::invalid(format!("not a web URL: {url}")));
|
||||
}
|
||||
let app = match id {
|
||||
None => None,
|
||||
let result = match id {
|
||||
None => open::that_detached(url),
|
||||
Some(id) => {
|
||||
let known =
|
||||
KNOWN.iter().find(|k| k.id == id).ok_or_else(|| IdeError::invalid(format!("unknown browser: {id}")))?;
|
||||
Some(locate(known).ok_or_else(|| IdeError::unavailable(format!("{} is not installed", known.name)))?)
|
||||
let app = locate(known).ok_or_else(|| IdeError::unavailable(format!("{} is not installed", known.name)))?;
|
||||
open::with_detached(url, app.to_string_lossy().as_ref())
|
||||
}
|
||||
};
|
||||
#[cfg(target_os = "linux")]
|
||||
let result = spawn_with_host_env(match &app {
|
||||
None => open::commands(url),
|
||||
Some(app) => vec![open::with_command(url, app.to_string_lossy())],
|
||||
});
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let result = match &app {
|
||||
None => open::that_detached(url),
|
||||
Some(app) => open::with_detached(url, app.to_string_lossy().as_ref()),
|
||||
};
|
||||
result.map_err(|e| IdeError::unavailable(format!("cannot open the browser: {e}")))
|
||||
}
|
||||
|
||||
/// Starts the first launcher that runs (`xdg-open`, `gio`, ...), with the host's environment
|
||||
/// rather than an AppImage's, and reaps it in the background.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn spawn_with_host_env(commands: Vec<std::process::Command>) -> std::io::Result<()> {
|
||||
use std::process::Stdio;
|
||||
let mut last_err = None;
|
||||
for mut cmd in commands {
|
||||
ide_core::process::prepare(&mut cmd).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null());
|
||||
match cmd.spawn() {
|
||||
Ok(mut child) => {
|
||||
std::thread::spawn(move || child.wait());
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => last_err = Some(e),
|
||||
}
|
||||
}
|
||||
Err(last_err.unwrap_or_else(|| std::io::Error::other("no launcher available")))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -98,8 +98,7 @@ fn json_to_toml(value: &Json) -> IdeResult<toml_edit::Value> {
|
||||
}
|
||||
Json::Object(map) => {
|
||||
let mut t = toml_edit::InlineTable::new();
|
||||
// TOML has no null: an unset optional field is left out.
|
||||
for (k, v) in map.iter().filter(|(_, v)| !v.is_null()) {
|
||||
for (k, v) in map {
|
||||
t.insert(k, json_to_toml(v)?);
|
||||
}
|
||||
t.into()
|
||||
@@ -107,33 +106,20 @@ fn json_to_toml(value: &Json) -> IdeResult<toml_edit::Value> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Sets (or removes, for `None`) a dotted key in a TOML document. A new
|
||||
/// `map_entry` object becomes a `[languageServers.ruff]` table rather than an
|
||||
/// inline table under an explicit `[languageServers]` header.
|
||||
fn set_in_document(doc: &mut DocumentMut, segments: &[&str], value: Option<toml_edit::Value>, map_entry: bool) {
|
||||
/// Sets (or removes, for `None`) a dotted key in a TOML document.
|
||||
fn set_in_document(doc: &mut DocumentMut, segments: &[&str], value: Option<toml_edit::Value>) {
|
||||
let (last, parents) = segments.split_last().expect("non-empty key");
|
||||
let mut table: &mut dyn TableLike = doc.as_table_mut();
|
||||
let mut in_inline = false;
|
||||
for seg in parents {
|
||||
if !table.get(seg).is_some_and(Item::is_table_like) {
|
||||
if value.is_none() {
|
||||
return;
|
||||
}
|
||||
// Implicit: no `[languageServers]` header above `[languageServers.ruff]`.
|
||||
let mut new = Table::new();
|
||||
new.set_implicit(true);
|
||||
table.insert(seg, Item::Table(new));
|
||||
table.insert(seg, Item::Table(Table::new()));
|
||||
}
|
||||
let item = table.get_mut(seg).expect("table just ensured");
|
||||
in_inline |= item.is_inline_table();
|
||||
table = item.as_table_like_mut().expect("table just ensured");
|
||||
table = table.get_mut(seg).and_then(Item::as_table_like_mut).expect("table just ensured");
|
||||
}
|
||||
match value {
|
||||
Some(toml_edit::Value::InlineTable(t))
|
||||
if map_entry && !in_inline && !matches!(table.get(last), Some(Item::Value(_))) =>
|
||||
{
|
||||
table.insert(last, Item::Table(t.into_table()));
|
||||
}
|
||||
Some(v) => match table.get_mut(last) {
|
||||
// Keep the key's decor (comments, spacing) when replacing a value.
|
||||
Some(Item::Value(existing)) => {
|
||||
@@ -202,19 +188,9 @@ impl SettingsStore {
|
||||
if segments.iter().any(|s| s.is_empty()) {
|
||||
return Err(IdeError::invalid(format!("invalid settings key {key:?}")));
|
||||
}
|
||||
let defaults = defaults_json();
|
||||
let mut cursor = &defaults;
|
||||
let mut map_entry = false;
|
||||
for (i, seg) in segments.iter().enumerate() {
|
||||
match cursor.get(seg) {
|
||||
Some(next) => cursor = next,
|
||||
// An entry of a map setting (`languageServers.rust-analyzer`): the merge below validates it.
|
||||
None if cursor.as_object().is_some_and(|m| m.is_empty()) => {
|
||||
map_entry = i + 1 == segments.len();
|
||||
break;
|
||||
}
|
||||
None => return Err(IdeError::invalid(format!("unknown setting {key:?}"))),
|
||||
}
|
||||
let mut cursor = &defaults_json();
|
||||
for seg in &segments {
|
||||
cursor = cursor.get(seg).ok_or_else(|| IdeError::invalid(format!("unknown setting {key:?}")))?;
|
||||
}
|
||||
|
||||
let text = match std::fs::read_to_string(&file) {
|
||||
@@ -226,7 +202,7 @@ impl SettingsStore {
|
||||
.parse()
|
||||
.map_err(|e| IdeError::invalid(format!("{} is not valid TOML; fix it first: {e}", file.display())))?;
|
||||
let new_value = if value.is_null() { None } else { Some(json_to_toml(&value)?) };
|
||||
set_in_document(&mut doc, &segments, new_value, map_entry);
|
||||
set_in_document(&mut doc, &segments, new_value);
|
||||
let new_text = doc.to_string();
|
||||
|
||||
// Validate the resulting stack before touching the disk.
|
||||
@@ -362,11 +338,6 @@ mod tests {
|
||||
assert_eq!(s.files.exclude, vec!["**/dist".to_string()]);
|
||||
let s = store.set(SettingsScope::Global, "editor.lineHeight", json!(22.5)).unwrap();
|
||||
assert_eq!(s.editor.line_height, 22.5);
|
||||
// An unset optional field (null) inside an object is left out.
|
||||
let ssh = json!([{ "id": "a", "name": "mac", "host": "macmini", "port": null, "user": "" }]);
|
||||
let s = store.set(SettingsScope::Global, "ssh.configs", ssh).unwrap();
|
||||
assert_eq!(s.ssh.configs[0].port, None);
|
||||
assert!(!std::fs::read_to_string(cfg.join("settings.toml")).unwrap().contains("port"));
|
||||
// Map-valued setting whose keys contain dots, replaced as a whole.
|
||||
let s = store
|
||||
.set(
|
||||
@@ -379,47 +350,6 @@ mod tests {
|
||||
let s =
|
||||
store.set(SettingsScope::Global, "appearance.statusBarWidgets", json!({"editor.caret": false})).unwrap();
|
||||
assert_eq!(s.appearance.status_bar_widgets.len(), 1);
|
||||
// One entry of a map setting, set and removed on its own.
|
||||
let s = store
|
||||
.set(
|
||||
SettingsScope::Global,
|
||||
"languageServers.rust-analyzer",
|
||||
json!({"args": ["--log"], "initializationOptions": {"check": {"command": "clippy"}}}),
|
||||
)
|
||||
.unwrap();
|
||||
let ra = &s.language_servers["rust-analyzer"];
|
||||
assert!(ra.enabled);
|
||||
assert_eq!(ra.args.as_deref(), Some(&["--log".to_string()][..]));
|
||||
assert_eq!(ra.initialization_options, Some(json!({"check": {"command": "clippy"}})));
|
||||
assert_eq!(
|
||||
store
|
||||
.set(SettingsScope::Global, "languageServers.rust-analyzer", json!({"enabled": "no"}))
|
||||
.unwrap_err()
|
||||
.kind,
|
||||
ide_core::error::ErrorKind::InvalidInput
|
||||
);
|
||||
let s = store.set(SettingsScope::Global, "languageServers.rust-analyzer", json!(null)).unwrap();
|
||||
assert!(s.language_servers.is_empty());
|
||||
// New parent tables stay implicit: no empty `[languageServers]` header.
|
||||
let fresh = tmp.path().join("fresh");
|
||||
let s = SettingsStore::load(&fresh, None)
|
||||
.set(SettingsScope::Global, "languageServers.ruff.languages", json!(["python"]))
|
||||
.unwrap();
|
||||
assert!(s.language_servers["ruff"].is_custom());
|
||||
let text = std::fs::read_to_string(fresh.join("settings.toml")).unwrap();
|
||||
assert_eq!(text, "[languageServers.ruff]\nlanguages = [\"python\"]\n");
|
||||
// A whole new entry: a table of its own, still under an implicit parent.
|
||||
let added = tmp.path().join("added");
|
||||
let s = SettingsStore::load(&added, None)
|
||||
.set(
|
||||
SettingsScope::Global,
|
||||
"languageServers.ruff",
|
||||
json!({"command": "ruff", "args": ["server"], "languages": ["python"]}),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(s.language_servers["ruff"].command, "ruff");
|
||||
let text = std::fs::read_to_string(added.join("settings.toml")).unwrap();
|
||||
assert_eq!(text, "[languageServers.ruff]\nargs = [\"server\"]\ncommand = \"ruff\"\nlanguages = [\"python\"]\n");
|
||||
|
||||
// Project layer is created on demand and wins.
|
||||
let s = store.set(SettingsScope::Project, "editor.fontSize", json!(12)).unwrap();
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
# 核心体验运行验收补测(2026-10-25)
|
||||
|
||||
本轮按用户缩小后的“核心体验”范围执行,**27个明确场景:修复复测后27通过、0失败**。这不是原94项清单全量完成声明;首轮发现的中文漏译及原清单未完成项仍保留。
|
||||
|
||||
实际版本:`d3feb05`(功能提交 `1e00ea5` 加版本更新)。macOS 原生调试应用,使用真实窗口、编辑器、已安装语言服务器、实际子进程与磁盘结果。测试项目是 `fixtures/ts-app` 的 `/tmp/idea-parity-qa/core-ts` 副本;Python调试和终端脚本仅写入该副本。首次验收未修改产品源码;随后按用户要求修复下列两处问题,运行版本为 `d3feb05` 加工作区改动,未在本仓库提交;Git验收仅在独立core-git副本里创建QA提交。
|
||||
|
||||
通过判定仅针对表内明确写出的步骤。重点编辑、查找、导航、补全、格式化、项目视图和 npm 运行做了亮/暗复测;调试、启动链等执行逻辑没有逐一覆盖所有主题和语言组合。数据库、Docker部署、复杂Git图/merge/rebase/worktree、设置导入导出、完整书签/布局/宏管理不在这次缩小后的核心范围内,原清单相关待测项仍保留。
|
||||
|
||||
## 修复复测(同日)
|
||||
|
||||
- IN-2:保留未过滤的服务器诊断;检查方案编辑时重新投影已完成或进行中的结果,同步严重级别和问题计数,保留排除状态。原生应用亮/暗各验证 error → warning → disabled → restored;还验证了禁用时执行检查,再启用无需重跑即恢复2条诊断。[结构化证据](/tmp/idea-parity-qa/fix-IN2-results.json)、[暗色恢复截图](/tmp/idea-parity-qa/fix-IN2-dark-restored.png)。
|
||||
- CSS:为共享语言服务器的 CSS、SCSS、Less 配置提供默认对象,避免 workspace/configuration 返回 null。三种文件分别打开 `.qa { colr: red; }`,均返回 unknownProperties 警告;新进程日志无 validProperties 异常。[诊断证据](/tmp/idea-parity-qa/fix-css-results.json)、[原生日志](/tmp/idea-parity-qa/fix-app.log)。
|
||||
- 验证:前端分析相关10项测试、LSP协议26项测试均通过;pnpm typecheck、原生 debug build、cargo clippy -p ide-lsp --all-targets -- -D warnings、cargo fmt 与 git diff --check 通过。新增回归覆盖方案修改、禁用后恢复、流式检查中修改方案、计数和原始严重级别恢复,以及真实内置配置的协议响应。
|
||||
|
||||
## 首次失败记录(已修复,保留复现过程)
|
||||
|
||||
### A. IN-2:旧 Inspect Code 结果不随检查方案更新
|
||||
|
||||
1. 打开 `src/qa-diagnostic.ts`:`const qaNumber: number = "wrong";`。
|
||||
2. 默认方案执行 Code › Inspect Code,仅检查当前文件,得到2条 TypeScript 错误。
|
||||
3. 将 TypeScript 检查严重级别设为 warning:编辑器变为黄色波浪线、Problems 显示 warning;旧 Inspection Results 仍是红色错误。
|
||||
4. 禁用该检查:编辑器无波浪线、Problems 清空;旧 Inspection Results 仍显示“2 problems in 1 file”。
|
||||
|
||||
期望:按 IN-2 的“同时变化”要求,三处采用同一有效方案。实际只有前两处即时更新。亮/暗均复现。[暗色截图](/tmp/idea-parity-qa/core-IN2-repro-dark.png)、[亮色截图](/tmp/idea-parity-qa/core-IN2-batch-disabled.png)、[结构化结果](/tmp/idea-parity-qa/core-IN2-repro-dark.json)。
|
||||
|
||||
**边界:重新执行 Inspect Code 后确实得到0条结果**,所以不是方案永远无效,而是已有批量结果的实时同步缺失。[重跑结果](/tmp/idea-parity-qa/core-IN2-rerun-disabled.json)。
|
||||
|
||||
实现线索:[inspect.ts](/Users/thomas/repo/kalo/idea/src/features/analysis/inspect.ts:183) 在启动时取得方案,接收事件时过滤一次并保存;[InspectionView.tsx](/Users/thomas/repo/kalo/idea/src/features/analysis/InspectionView.tsx:219) 的树以已有 files 构建,没有将方案变化作为依赖。这与首次运行现象一致;现已按上节修复。
|
||||
|
||||
### B. CSS 语言服务器校验抛异常
|
||||
|
||||
1. 在副本新建并打开 `src/qa-validation.css`:`.qa { colr: red; }`。
|
||||
2. 等待已安装的 `vscode-css-language-server` 校验。
|
||||
3. 日志出现 `TypeError: Cannot read properties of null (reading 'validProperties')`,诊断列表为空,错误属性没有提示。
|
||||
|
||||
期望:默认 CSS 校验正常运行并对未知属性给出诊断,不抛异常。新建两个空 CSS 时已出现同一异常;专用错误样例和原生进程重启后再次复现。[运行日志及诊断](/tmp/idea-parity-qa/core-css-validation.json)、[编辑器截图](/tmp/idea-parity-qa/core-css-validation.png)、[重启日志](/tmp/idea-parity-qa/core-app-restart.log)。
|
||||
|
||||
首次排查线索为 [handler.rs](/Users/thomas/repo/kalo/idea/crates/ide-lsp/src/handler.rs:119) 的 workspace/configuration:未配置 section 返回 null。现已验证默认配置对象可修复该异常,见上节。
|
||||
|
||||
## 完成的核心场景
|
||||
|
||||
| 编号 | 结果 | 场景 | 实际验证 | 证据 |
|
||||
|---|---|---|---|---|
|
||||
| C01 | 通过 | 编辑与保存 | 输入、撤销、重做、保存磁盘、外部写入自动重载;亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-edit-confirm-results.json) |
|
||||
| C02 | 通过 | 常用编辑命令 | 同一行注释/取消注释、复制行,验证实际文档结果;亮/暗各复测。注释命令会移动到下一行,复测时重新定位原行。 | [记录](/tmp/idea-parity-qa/core-edit-commands-final-dark.json) |
|
||||
| C03 | 通过 | 项目视图与恢复 | 五种视图均切换;Open Files 成目录树;All Changed Files 仅包含被修改的已跟踪 index.ts。结束并重新启动原生进程后仍为 Open Files,23个打开路径与重启前完全一致。 | [记录](/tmp/idea-parity-qa/core-persist-after.json) |
|
||||
| C04 | 通过 | New 搜索和创建 | 项目树焦点下 ⌘N 出现 Search for file type;css 能找到 Stylesheet。CSS/SCSS/Less、Dockerfile、EditorConfig、gitignore、JSON/YAML/TOML/Shell/HTTP 的磁盘结果沿用首轮实际创建证据。 | [记录](/tmp/idea-parity-qa/core-NF1-dark.png) |
|
||||
| C05 | 通过 | ⌘N 上下文路由 | Python/Markdown 打开 New,并实际在当前文件的 src 目录创建 CSS;Java/Kotlin/TS 的动作轨迹为 code.generate,未打开 New。Kotlin 只验证路由,未声称生成代码可用。 | [记录](/tmp/idea-parity-qa/core-lastkeys.log) |
|
||||
| C06 | 通过 | 项目树文件操作 | 从选中的 src 目录 New › File 创建 qa-tree-created.txt;Rename 后旧路径消失、新路径存在;确认移至 Trash 后新路径消失。 | [记录](/tmp/idea-parity-qa/core-tree-deleted.json) |
|
||||
| C07 | 通过 | 文件内上下文查找 | In Comments 仅选中三个注释内的 shared(含 shared_history),Next/Previous 在位置3/38/78间导航,不命中代码和字符串;亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-find-final.log) |
|
||||
| C08 | 通过 | 替换大小写与排除 | Preserve Case 实际得到 bar/Bar/BAR;排除项出现删除线,Replace All 保留该项、替换其余项;亮/暗重新验证。 | [记录](/tmp/idea-parity-qa/core-FB4-final-dark.png) |
|
||||
| C09 | 通过 | 多行及搜索历史 | ⇧⌘↵ 输入跨行 alpha/beta 后计数1/1并选中完整跨行文本;⌥↓ 能打开编辑器历史,Find in Files 也显示新增 QA_shared_history。 | [记录](/tmp/idea-parity-qa/core-FB5-dark-confirm.png) |
|
||||
| C10 | 通过 | 自定义搜索范围 | 三个文件同一标记:不限定时3个文件;file:src//*.ts&&!file:*test* 仅命中 qa_scope.ts;Inspect Code 的 Custom scope 可选同一 Core TS Scope。 | [记录](/tmp/idea-parity-qa/core-FF3-final.png) |
|
||||
| C11 | 通过 | 跨文件替换与预览 | 两个文本文件6处替换,预览显示 Bar/BAR/bar,确认后磁盘一致;多行搜索可命中多个文件。保留大小写在亮/暗分别确认。 | [记录](/tmp/idea-parity-qa/core-FF4-dark-final.json) |
|
||||
| C12 | 通过 | 搜索排除归档 | 在项目内放入含唯一标记的 zip、jar,Find in Files 返回 No matches;不是只根据代码推断。 | [记录](/tmp/idea-parity-qa/core-FF5-archive.png) |
|
||||
| C13 | 通过 | 文件/类型/符号导航 | Go to File 打开 money.ts,Go to Class 打开 Cart,Go to Symbol 打开 formatMoney;调用点转到 Cart 定义,Back/Forward 正确返回和前进;亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-navigation.log) |
|
||||
| C14 | 通过 | Search Everywhere 筛选 | Files 排除 TypeScript、Classes 排除 Classes、Symbols 排除 Functions、Text 设 *.py,结果分别被过滤;切换页后各页值独立保留;亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-filters-final.log) |
|
||||
| C15 | 通过 | Actions 跳转设置 | 复选框为 Include disabled actions;搜索 code completion 有 Settings: Editor | General,选中后回车打开原生 Settings 的 Code Completion 页。 | [记录](/tmp/idea-parity-qa/core-NV2-target-final.png) |
|
||||
| C16 | 通过 | 重命名与 Generate | ⇧F6 原地重命名,第二次 ⇧F6 打开名称对话框;qaOriginalName 的声明和引用一起改为 qaRenamed。TS ⌘N 对缺失接口方法执行 Generate,生成 run() 实现。 | [记录](/tmp/idea-parity-qa/core-rename-clean.log) |
|
||||
| C17 | 通过 | LSP 补全 | 单候选自动插入开关实际改变行为;字母排序有效;函数补全插入(),有参数时光标在括号内且显示参数提示;无参光标在括号后;已有(不重复。亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-completion.log) |
|
||||
| C18 | 通过 | 格式化保护区 | 手动 Reformat 与保存时格式化都格式化保护区外的代码,@formatter:off/on 中间保持逐字不变;亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-IN7-save-dark.json) |
|
||||
| C19 | 通过 | 检查结果同步(IN-2) | 修复后亮/暗均验证严重级别、禁用和恢复即时同步,禁用时运行后重新启用也可恢复旧结果,无需重跑。 | [记录](/tmp/idea-parity-qa/fix-IN2-results.json) |
|
||||
| C20 | 通过 | 运行与测试反馈 | npm start 输出购物车合计 $134.97、退出0;正常测试通过;开启 opt-in 失败测试后树显示1 failed/4 passed、断言和源文件行、退出1。亮/暗各复测。 | [记录](/tmp/idea-parity-qa/core-runactual-final.log) |
|
||||
| C21 | 通过 | Current File 与调试 | Current File 直接运行 TS 输出 QA_CURRENT_FILE_OK;Python Current File 调试命中断点,显示 number=21,进入 double、越过后 answer=42,求值返回42,跳出、恢复后输出42、退出0。TS 调试器另列环境阻塞。 | [记录](/tmp/idea-parity-qa/core-debug-final-console.png) |
|
||||
| C22 | 通过 | Before launch 执行链 | 先运行子配置,再成功 Build,再 shell,最后主进程;记录 child/shell/main,Build 成功且主子退出0。额外验证非0步骤阻止启动并通知、循环引用被拒绝。 | [记录](/tmp/idea-parity-qa/core-RC6-success.json) |
|
||||
| C23 | 通过 | Compound | 两个成员17ms间隔启动并同时处于 running;选择 compound、从编辑器触发 Stop 后两个成员均 finished/130。 | [记录](/tmp/idea-parity-qa/core-RC7-stopped.json) |
|
||||
| C24 | 通过 | 交互终端 | PTY 输入 hello 得到回显;QA_RED 在亮/暗为红色;窗口缩放使子进程收到尺寸233→89列,恢复后120列;输入exit正常退出0,另一次Stop退出130。 | [记录](/tmp/idea-parity-qa/core-RC9-resize.png) |
|
||||
| C25 | 通过 | Power Save 核心行为 | 正常模式自动补全弹出;开启后同样输入不弹出,编辑器有横幅;有效配置同时关闭 usages Code Vision 等后台提示。随后关闭并确认重启后 false;未把这等同于全部后台任务性能验证。 | [记录](/tmp/idea-parity-qa/core-WB7-enabled.json) |
|
||||
| C26 | 通过 | CSS 校验集成 | 修复后重新编译并启动原生应用,CSS/SCSS/Less 均对 colr 返回 unknownProperties 警告,日志无原异常。 | [记录](/tmp/idea-parity-qa/fix-css-results.json) |
|
||||
| C27 | 通过 | Git常用流程 | 独立Python副本中查看HEAD与工作区diff,显示唯一QA标记差异;Commit先报告已有2个警告,选择Commit Anyway后实际提交,git diff为空,Git Log显示新提交。未推送。 | [记录](/tmp/idea-parity-qa/core-git-final.json) |
|
||||
|
||||
## 环境和验证边界
|
||||
|
||||
- Python debugpy 1.8.22 已安装,断点、变量、求值、三种单步和正常退出都实际验证。`js-debug` 未安装,**TypeScript/Node 调试没有通过判定**,没有拿 Python 的结果替代它。
|
||||
- Kotlin 两个语言服务器和 Marksman 缺失。Kotlin 的 ⌘N 仅确认路由到 Generate;未声称 Kotlin 代码生成/补全/重构已通过。
|
||||
- 部分配置通过真实 settings IPC 写入副本,运行配置执行链通过真实注册动作启动;没有把这些视作配置编辑器每个鼠标流程都已验收。
|
||||
- 第一次应用运行经过热更新,产生过状态模块/焦点残留;已关闭该调试进程、单独启动Vite和编译好的原生二进制后复测快捷键。干净启动后重命名和 Generate 正常,因此不列为产品失败。
|
||||
- `document.execCommand` 在终端缩放后的第二次注入没有发送文本;改用 textarea 的 InputEvent 后回显与正常退出均成功。这是驱动差异,不列为产品键入失败。使用的桥接输入均未被等同于人工键盘全矩阵验证。
|
||||
- 已结束并重启原生进程,Open Files 模式和23个打开路径完整恢复。[重启前](/tmp/idea-parity-qa/core-persist-before.json)、[重启后](/tmp/idea-parity-qa/core-persist-after.json)。记录中的 `/tmp` 与 `/private/tmp` 双路径是测试脚本先后用两种路径打开同一文件造成,没有将其直接列为正常用户路径问题。
|
||||
- 本轮没有应用崩溃;没有做量化卡顿测试。故意失败的测试、Before launch失败和Stop后的130通知均为测试输入产生;独立异常是上面的CSS服务器错误。
|
||||
- 本轮无产品代码改动,因此没有重复运行完整构建测试;首轮的 typecheck 与30个相关Vitest结果仍单独记录,不作为运行场景的替代。
|
||||
- 测试进程已停止;Power Save 恢复为false;全局语言/主题未新增改动。副本和截图保留供复核。
|
||||
@@ -0,0 +1,125 @@
|
||||
# IDEA 对齐运行验收记录(2026-10-25)
|
||||
|
||||
结论:**尚未达到全量验收通过条件**。累计94项中,功能断言通过35项、失败1项、部分验证58项。IN-2与清单外CSS校验异常已修复并经原生应用复测。核心复测27场景的具体范围、修复后27通过/0失败结论见[核心补测报告](acceptance-idea-core-result.md);不能把本次核心补测当作原94项全部完成。
|
||||
|
||||
目标提交为 `1e00ea5`;启动后仓库由外部更新为 `d3feb05 chore: v0.1.14`,仅版本文件变化,实际后续验收运行此版本。首次验收未改动产品源码;随后按用户要求修复IN-2和CSS配置,版本为 `d3feb05` 加工作区改动,未提交。测试均使用 `/tmp/idea-parity-qa/` 下的 fixture 副本。
|
||||
|
||||
使用 `pnpm tauri dev` 启动真实 macOS Tauri 应用,桥接操作真实 DOM、注册动作,并读取运行结果。部分设置通过真实 IPC 写入测试项目配置,以核对运行时行为;这不替代 Settings 原始鼠标路径或快捷键验证。热更新造成的旧模块实例问题已识别,相关外部库检查重新使用运行中的模块后重做;以 `libraries-final.log` 为准。
|
||||
|
||||
亮/暗主题已抽查 New、查找、运行配置、数据库、工具栏、Cleanup;未做到94项各自双主题全覆盖,主题总要求仍未完成。中文抽查发现可复现漏译。未观察到功能整体缺失;未覆盖项不能据此判定已实现。
|
||||
|
||||
辅助检查:`pnpm typecheck` 退出码0;4个相关 Vitest 文件共30个测试通过(libraries、NewPopup、file templates、run-anything)。没有重新运行完整 Rust/前端测试,不沿用清单中旧提交的通过数作为本轮证据。
|
||||
|
||||
## 逐项记录
|
||||
|
||||
| 编号 | 结果 | 现象、范围和证据 |
|
||||
|---|---|---|
|
||||
| PV-1 | 通过 | 真实 Project 标题下拉列出五种要求的模式;[证据](/tmp/idea-parity-qa/PV-1-menu.png) |
|
||||
| PV-2 | 通过 | 核心复测:五种模式已操作;Open Files 成树、All Changed Files 仅显示修改的已跟踪文件;原生进程重启后 Open Files 和23个打开路径恢复。[证据](/tmp/idea-parity-qa/core-persist-after.json) |
|
||||
| PV-3 | 通过 | Open Files 中定位未打开的 README.md,自动回到 Project 并选中 |
|
||||
| PV-4 | 部分 | Python 副本已建 .venv,External Libraries 注册标准库、venv 库和 site-packages;.venv 下逐级展开对照未完成;[证据](/tmp/idea-parity-qa/PV-6-python-app.png) |
|
||||
| PV-5 | 部分 | 在副本 site-packages 新建 qa_library.py,经编辑器插入文字后内容和磁盘均不变,readOnly=true,横幅正常;节点重命名/删除/新建/拖拽未逐项操作;[证据](/tmp/idea-parity-qa/PV-5-blocked-input.png) |
|
||||
| PV-6 | 部分 | Rust stdlib、Go SDK、JDK/src.zip、Gradle junit-jupiter 源码 jar、TS 的 typescript/vitest 直接依赖均已识别并注册到树;Cargo 依赖、Go 模块和 Maven 分组未完整覆盖;[证据](/tmp/idea-parity-qa/libraries-final.log) |
|
||||
| PV-7 | 部分 | JDK src.zip!/java.base/java/lang/String.java 实际打开,语法高亮、readOnly=true;树内逐级浏览及另一个 jar 未完整操作;[证据](/tmp/idea-parity-qa/PV-7-archive.png) |
|
||||
| PV-8 | 通过 | TS 副本 package.json 添加已在 node_modules 中的 qa-dep;857ms 后 External Libraries 已出现该依赖,随后恢复清单;[证据](/tmp/idea-parity-qa/PV-8-refresh.json) |
|
||||
| NF-1 | 通过 | 核心复测:项目树选中src,⌘N 打开带搜索框的 New;css 找到 Stylesheet。随后 New › File 实际在src创建文件。[证据](/tmp/idea-parity-qa/core-tree-new-parent.json) |
|
||||
| NF-2 | 通过 | 实际创建 CSS、SCSS、Less、Dockerfile、.editorconfig、.gitignore、JSON、YAML、TOML、Shell 和 HTTP 文件;核对磁盘扩展名及模板内容;[证据](/tmp/idea-parity-qa/templatesactual.log) |
|
||||
| NF-3 | 通过 | 核心复测:Python/Markdown 的 ⌘N 均打开 New,实际创建的CSS都在当前文件的src目录。[证据](/tmp/idea-parity-qa/core-lastkeys.log) |
|
||||
| NF-4 | 通过 | 核心复测:Java/Kotlin/TS 的 ⌘N 动作轨迹为 code.generate,均不打开 New;TS 实际生成缺失接口方法。Kotlin只验证路由,语言服务器缺失。[证据](/tmp/idea-parity-qa/core-NF4-generate.png) |
|
||||
| NF-5 | 部分 | 动作能弹出 New 并在当前 worker 目录创建文件;任意焦点和 ⌃⌥N 按键矩阵未完整验证;[证据](/tmp/idea-parity-qa/NF-5.png) |
|
||||
| NF-6 | 通过 | 创建 /tmp/idea-parity-qa/qa-new-project,勾选 Git,磁盘 .git 存在,出现独立 project-1 窗口;[证据](/tmp/idea-parity-qa/NF-6-created.json) |
|
||||
| NF-7 | 部分 | 重命名为 QA renamed project 后原生窗口标题更新,polyglot 磁盘目录保持原名;最近项目列表未单独检查;[证据](/tmp/idea-parity-qa/NF-7-renamed.png) |
|
||||
| FB-1 | 通过 | 漏斗列出 Search In Selection 和清单中的六种上下文范围;[证据](/tmp/idea-parity-qa/FB-1-filter.png) |
|
||||
| FB-2 | 通过 | 核心复测:In Comments 计数3;Next/Previous在三个注释位置间跳转,不命中代码/字符串;亮暗均验证。[证据](/tmp/idea-parity-qa/core-find-final.log) |
|
||||
| FB-3 | 通过 | 9 处 foo/Foo/FOO 替换为 bar/Bar/BAR,磁盘副本编辑内容符合预期;[证据](/tmp/idea-parity-qa/FB-3-result.png) |
|
||||
| FB-4 | 通过 | 排除第一处匹配后显示删除线,Replace All 保留该处 bar,其余变为 baz;[证据](/tmp/idea-parity-qa/FB-4-result.png) |
|
||||
| FB-5 | 通过 | 核心复测:⇧⌘↵ 后跨行输入alpha/beta,计数1/1、选择完整跨行内容;亮暗均确认。[证据](/tmp/idea-parity-qa/core-FB5-dark-confirm.png) |
|
||||
| FB-6 | 通过 | 核心复测:⌥↓ 打开编辑器最近搜索,新增QA_shared_history同时出现在 Find in Files 的最近搜索。[证据](/tmp/idea-parity-qa/core-find-final.log) |
|
||||
| FF-1 | 通过 | 真实窗口显示 In Project/Module/Directory/Scope,polyglot Module 下拉含根模块及 api、web;[证据](/tmp/idea-parity-qa/FF-1-options.json) |
|
||||
| FF-2 | 通过 | 新建并保存自定义 scope;!(file:src//* 实时显示 Missing `)` 错误,合法表达式出现在下拉;[证据](/tmp/idea-parity-qa/FF-2-real-invalid.png) |
|
||||
| FF-3 | 通过 | 核心复测:自定义Scope将3个标记文件缩至唯一qa_scope.ts;Inspect Code的Custom scope也能选Core TS Scope。[证据](/tmp/idea-parity-qa/core-FF3-final.png) |
|
||||
| FF-4 | 通过 | 核心复测:跨文件多行搜索命中;6处替换的保留大小写预览与磁盘Bar/BAR/bar一致;亮暗均确认。[证据](/tmp/idea-parity-qa/core-FF4-dark-final.json) |
|
||||
| FF-5 | 通过 | 核心复测:项目内jar/zip包含唯一标记,Find in Files不命中。[证据](/tmp/idea-parity-qa/core-FF5-archive.png) |
|
||||
| NV-1 | 通过 | 核心复测:四页分别过滤文件类型/类种类/符号种类/文件掩码,结果变化且各页保留独立选择;亮暗均验证。[证据](/tmp/idea-parity-qa/core-filters-final.log) |
|
||||
| NV-2 | 通过 | 核心复测:文案正确;Settings: Code Completion结果回车打开原生设置的对应页面。[证据](/tmp/idea-parity-qa/core-NV2-target-final.png) |
|
||||
| NV-3 | 部分 | 未执行:动作快捷键录入、生效与三种冲突解决 |
|
||||
| NV-4 | 部分 | 未执行:书签列表新建/重命名/删除/默认列表/移动矩阵 |
|
||||
| NV-5 | 部分 | 书签弹窗入口存在且空状态正常;文件、文件夹、行书签及按列表分组跳转未执行;[证据](/tmp/idea-parity-qa/NV-5.png) |
|
||||
| NV-6 | 部分 | 未执行:Structure 字段/非公开成员/可见性排序 |
|
||||
| NV-7 | 部分 | 未执行:支持 typeHierarchy 的 TS/Java 继承成员及跳转 |
|
||||
| NV-8 | 部分 | Recent Locations 有相对时间和代码片段;类/方法面包屑和片段高亮未完整核对;[证据](/tmp/idea-parity-qa/NV-8.png) |
|
||||
| NV-9 | 部分 | 已提交 fixture 的 Python 函数出现 Thomas Hong 作者;Settings 有 Code author;多人 +N 及关闭效果未验证 |
|
||||
| ED-1 | 通过 | 核心复测:关闭单候选自动插入时保留一个候选,开启后实际自动插入;亮暗均确认。[证据](/tmp/idea-parity-qa/core-completion.log) |
|
||||
| ED-2 | 通过 | 核心复测:打开Sort suggestions alphabetically后真实候选按名称排序,popup含Sort by name;通过设置开关路径验证。[证据](/tmp/idea-parity-qa/core-ED2-sorted-dark.png) |
|
||||
| ED-3 | 通过 | 核心复测:有参/无参函数自动括号、光标落点和参数提示符合要求;已有(不重复;亮暗均验证。[证据](/tmp/idea-parity-qa/core-completion.log) |
|
||||
| ED-4 | 部分 | Top/Bottom/Left/Right/None 均切换并截图,左右为竖排,None 隐藏标签;滚动、拖拽和菜单一致性未逐项验证;[证据](/tmp/idea-parity-qa/ED-4-none.png) |
|
||||
| ED-5 | 部分 | Editor Tabs 的相关设置项齐全;每种选项实际行为未逐项验证;[证据](/tmp/idea-parity-qa/settings-Editor-Tabs.png) |
|
||||
| ED-6 | 部分 | Inline Completion 设置页存在;未配置支持 inlineCompletion 的服务,运行预览及快捷键跳过,不能视为通过;[证据](/tmp/idea-parity-qa/settings-Inline-Completion.png) |
|
||||
| IN-1 | 部分 | Inspections 页面有方案、搜索、按语言树和描述区域;三态与 Severity 的编辑操作未完成;[证据](/tmp/idea-parity-qa/IN-1-settings.png) |
|
||||
| IN-2 | 通过 | 修复复测:亮/暗下编辑器和旧Inspect Code结果随严重级别、禁用、恢复即时同步,计数同步;禁用时运行后也能重新启用恢复诊断,无需重跑。[证据](/tmp/idea-parity-qa/fix-IN2-results.json) |
|
||||
| IN-3 | 部分 | 未执行:检查方案 Duplicate/Copy/Rename/Delete 和内置方案保护 |
|
||||
| IN-4 | 部分 | 测试副本已写入 recieve;注释/字符串/声明和调用名的诊断对照未完成 |
|
||||
| IN-5 | 部分 | Spelling 设置页面存在;Typo 上下文候选及保存两类词典未执行;[证据](/tmp/idea-parity-qa/settings-Spelling.png) |
|
||||
| IN-6 | 部分 | Code Style 页面有 Default (IDE) Scheme 与 Copy to Project;语言子页面联动未完整操作;[证据](/tmp/idea-parity-qa/settings-Code-Style.png) |
|
||||
| IN-7 | 通过 | 核心复测:手动及保存格式化都格式化保护区之外,formatter:off/on之间逐字保持;亮暗均验证。[证据](/tmp/idea-parity-qa/core-IN7-save-dark.json) |
|
||||
| IN-8 | 通过 | 项目配置 Do not format 为 *.json,执行 Reformat Code 出现明确跳过提示;[证据](/tmp/idea-parity-qa/IN-8-excluded.png) |
|
||||
| IN-9 | 部分 | Cleanup 范围及 fix/import/format 选项存在,可取消;实际清理结果和中途取消未执行;[证据](/tmp/idea-parity-qa/IN-9.png) |
|
||||
| FT-1 | 部分 | 打开 x.foo 后添加 YAML 关联,现有 editor context 立即变为 yaml/YAML;图标及 Go to File 未独立核对;[证据](/tmp/idea-parity-qa/FT-1-yaml.png) |
|
||||
| FT-2 | 部分 | 调用同名注册动作使 YAML→JSON→YAML,现有编辑器立即更新;右键菜单路径及撤销未操作;[证据](/tmp/idea-parity-qa/FT-2-revert.json) |
|
||||
| FT-3 | 通过 | 无扩展名 qa-hashbang 带 #!/usr/bin/env python3,实际 editor context 为 python/Python;[证据](/tmp/idea-parity-qa/FT-3-hashbang.png) |
|
||||
| PS-1 | 部分 | 添加外部 extra-root 后树出现根,Find in Files 命中 extra.ts;Go to File 和外部文件修改刷新未完整验证;[证据](/tmp/idea-parity-qa/PS-1-search.png) |
|
||||
| PS-2 | 部分 | 即时设置 *.log;tmp* 后 Find in Files 不再命中 qa.log 中的唯一标记;树与索引侧未独立核对;[证据](/tmp/idea-parity-qa/PS-2-search.png) |
|
||||
| TP-1 | 部分 | File and Code Templates 页面包含 Includes,说明支持 #parse;编辑 File Header 后新建 Java/Kotlin 未执行 |
|
||||
| TP-2 | 部分 | 模板页有 Code 标签;修改测试方法模板并生成测试未执行 |
|
||||
| TP-3 | 部分 | Reformat according to style 默认已勾选;$END$ 光标及格式化效果未单独验证;[证据](/tmp/idea-parity-qa/settings-File-and-Code-Templates.png) |
|
||||
| RC-1 | 通过 | 核心复测:Current File保持可选,直接运行TS输出正确;Python Current File调试命中断点并可单步/求值/正常退出。Node调试器缺失单独记为环境阻塞。[证据](/tmp/idea-parity-qa/core-debug-final-console.png) |
|
||||
| RC-2 | 通过 | + 菜单列出所有要求类型,含 Compound 与 Docker 三种子类型,搜索输入存在;[证据](/tmp/idea-parity-qa/RC-2-types.png) |
|
||||
| RC-3 | 部分 | 实际新建 Shell/Program,Program env 运行成功,检测配置正常;其余每种类型执行及旧配置兼容未覆盖;[证据](/tmp/idea-parity-qa/RC-8-process-output.png) |
|
||||
| RC-4 | 部分 | 表单支持复制/分组/排序/Templates;对话框 Run 成功,local TOML 已落盘且 git check-ignore 命中 .openidea/.gitignore;其余子流程未逐项执行 |
|
||||
| RC-5 | 部分 | Modify options 显示各类可选项;移除控件与各选项的运行效果未完整验证;[证据](/tmp/idea-parity-qa/RC-5.json) |
|
||||
| RC-6 | 通过 | 核心复测:实际子配置→Build→Shell→主进程;Build成功,记录child/shell/main;失败步骤中止并通知,循环被拒绝。[证据](/tmp/idea-parity-qa/core-RC6-success.json) |
|
||||
| RC-7 | 通过 | 核心复测:两成员17ms间隔启动并同时running,选中compound从编辑器触发Stop后都结束、退出130。[证据](/tmp/idea-parity-qa/core-RC7-stopped.json) |
|
||||
| RC-8 | 部分 | A=1;B=2 输入后对话框拆成两行,关闭系统环境后 /usr/bin/env 仅输出 A/B,退出码 0;独立 Paste 按钮未操作;[证据](/tmp/idea-parity-qa/RC-8-process-output.png) |
|
||||
| RC-9 | 通过 | 核心复测:PTY回显、亮暗ANSI颜色、resize传到子进程(233→89列)均正常;输入exit退出0,另次Stop退出130。[证据](/tmp/idea-parity-qa/core-RC9-resize.png) |
|
||||
| RC-10 | 部分 | 空 Run 显示三条提示及 run configuration 链接;点击链接未操作 |
|
||||
| RC-11 | 部分 | 本机 Docker 可用,但未运行/停止 fixture Docker 和 Compose,不能视为通过 |
|
||||
| GT-1 | 部分 | Graph Options 所列排序和分支选项齐全;复杂分支图下的效果未执行;[证据](/tmp/idea-parity-qa/GT-1-options.png) |
|
||||
| GT-2 | 部分 | View Options 所列显示项和 Highlight 存在;开关效果及重启持久化未完整验证;[证据](/tmp/idea-parity-qa/GT-2-options.png) |
|
||||
| GT-3 | 部分 | 未执行:Log 焦点 ⌘F、补全、跳转及自动加载更多 |
|
||||
| GT-4 | 部分 | 未执行:设置 Date 过滤后图仍保留 |
|
||||
| GT-5 | 部分 | 七种对话框均实际打开,选项可见;未执行 pull/merge/rebase/worktree/clone 的磁盘变化;[证据](/tmp/idea-parity-qa/gitcheck.log) |
|
||||
| SV-1 | 部分 | Add Service 菜单有三类要求入口;⌘N 和无连接空状态未完整验证;[证据](/tmp/idea-parity-qa/SV-1.png) |
|
||||
| SV-2 | 部分 | 实际 Program/Run Anything/PTY 均已启动;Services 中运行配置分组与停止/重跑/输出跳转未验证 |
|
||||
| SV-3 | 部分 | 自动连接 orbstack,显示容器、镜像、卷和网络;新建多个连接及绑定操作路由未执行;[证据](/tmp/idea-parity-qa/SV-1.png) |
|
||||
| TD-1 | 部分 | TODO 有 Scope Based、Changes,显示7条 fixture TODO/FIXME;自定义范围和多个 changelist 下拉未验证;[证据](/tmp/idea-parity-qa/TD-1.png) |
|
||||
| CV-1 | 部分 | LCOV 导入显示 app.ts 50%(1/2),管理弹窗列出报告;Go/JaCoCo、多报告切换和 gutter 未完整验证;[证据](/tmp/idea-parity-qa/CV-1-import.png) |
|
||||
| DB-1 | 部分 | Driver 下拉按字母列出 CockroachDB/Redshift/TiDB 等;逐种默认端口未核对;[证据](/tmp/idea-parity-qa/DB-1-list.png) |
|
||||
| DB-2 | 通过 | 指定 JDBC URL 解析出 h、5432、db,SSL 页为 Verify Full;[证据](/tmp/idea-parity-qa/DB-2-ssl.png) |
|
||||
| DB-3 | 部分 | Options/Schemas/Advanced 页签存在;未连 SQLite/Postgres 验证只读/启动脚本/时区/过滤/驱动属性 |
|
||||
| DB-4 | 部分 | 颜色和 Add comment 控件存在;树节点、console 标签及 hover 效果未验证 |
|
||||
| WB-1 | 部分 | Run Anything 执行 pwd,输出进入 Run,cwd 为 fixture,退出码0,并列出检测配置;双 Ctrl、Maven/Gradle 和新历史未完整验证;[证据](/tmp/idea-parity-qa/WB-1-output.png) |
|
||||
| WB-2 | 部分 | Customize Main Toolbar 可打开并显示增删/排序/恢复控件;实际保存和重启持久化未执行;[证据](/tmp/idea-parity-qa/WB-2.png) |
|
||||
| WB-3 | 部分 | Save Current Layout as 弹出命名输入;另存、恢复、重命名、删除完整流程未执行;[证据](/tmp/idea-parity-qa/WB-3-save.json) |
|
||||
| WB-4 | 部分 | 未执行:原生 View › Tool Windows 与注册表的一一核对 |
|
||||
| WB-5 | 部分 | Quick Switch Scheme 弹出四类选项;其余菜单命令及所有效果未完整验证;[证据](/tmp/idea-parity-qa/WB-5.png) |
|
||||
| WB-6 | 部分 | 无可用重构位置弹出 Nothing here;原生菜单上下文置灰未验证;[证据](/tmp/idea-parity-qa/WB-6.png) |
|
||||
| WB-7 | 部分 | Power Save Mode 切换后编辑器出现横幅,随后关闭恢复;后台高亮与自动弹出抑制未完整验证;[证据](/tmp/idea-parity-qa/WB-7-real.png) |
|
||||
| WB-8 | 部分 | 未执行:完整 Export/Import 设置与快捷键、模板、宏、布局恢复 |
|
||||
| WB-9 | 部分 | 录制 QA macro 后回放,内容为 QA macroQA macro;保存命名和 Keymap 绑定未执行;[证据](/tmp/idea-parity-qa/WB-9-replay-result.png) |
|
||||
| WB-10 | 部分 | Coverage 导入的信息通知显示 Don’t Show Again;点击后同类通知抑制未验证 |
|
||||
| I18N-1 | 失败 | 复现:切换中文,打开 Code › Code Cleanup。实际 Whole project、Module or directory、Uncommitted files 和底部说明仍为英文;打开 Customize Main Toolbar 后 Project Widget/VCS Widget/Build Project/Run Widget 仍为英文;Services 的 Containers/Images/Volumes/Networks 仍为英文。期望这些新增界面文案均翻译;均不属于清单已知例外;[证据](/tmp/idea-parity-qa/IN-zh-dark.png) |
|
||||
|
||||
## 独立问题与环境说明
|
||||
|
||||
- 崩溃:已执行流程中未观察到应用崩溃。版本更新引起的 dev 自动重编译不是崩溃。
|
||||
- 控制台:有自动化自身造成的错误(错误 action id、首次尝试不存在的文件、带换行注入脚本的 Unexpected EOF)和手动 reload 后 Tauri callback 警告;不归为产品功能失败。尚不能声明控制台全量无错误。应用日志在 [/tmp/idea-parity-qa.log](/tmp/idea-parity-qa.log)。
|
||||
- 卡顿:未观察到已执行操作中的明显持续卡顿;没有完成量化性能验收。桥接脚本等待用户输入对话框导致的超时不按应用卡顿计。
|
||||
- 核心补测新增的CSS语言服务器validProperties空值异常已修复;CSS/SCSS/Less真实校验均返回未知属性警告,见核心报告修复复测。
|
||||
- Python REPL 的 Stop 先发中断(出现 KeyboardInterrupt),随后超时强制结束,最终137/SIGKILL;这是本轮观察结果,未仅凭此判失败。
|
||||
- 首轮安装TS依赖时pnpm提示esbuild脚本未批准;核心补测已实际运行npm start及正常/故意失败测试。Build通过专用最小TS目标验证,未据此宣称所有原始QA文件能通过类型检查。
|
||||
- 全量放行前仍需完成表中的未执行子项,包括所有语言/运行类型、Docker、复杂Git图与合并/变基、数据库、设置导入导出、完整书签/布局管理等;双主题逐项与中文复测也未全覆盖。Before launch、Compound、补全和基础运行/调试已有核心复测证据,见对应行。
|
||||
|
||||
截图和结构化证据目录:[/tmp/idea-parity-qa](/tmp/idea-parity-qa)。验收期间使用的全局主题、语言和 Power Save Mode 已恢复;最后录制宏为 QA 样例,测试项目仍保留供复核。
|
||||
|
||||
|
||||
核心补测:新增真实编辑、导航、补全、重命名、检查同步、运行/调试、Before launch/Compound、PTY和原生重启验证;详情见[核心补测报告](acceptance-idea-core-result.md)。原表中其他待测子项仍保留,不因核心补测而自动变绿。
|
||||
|
Після Ширина: | Висота: | Розмір: 169 KiB |
|
Після Ширина: | Висота: | Розмір: 133 KiB |
|
Після Ширина: | Висота: | Розмір: 171 KiB |
|
Після Ширина: | Висота: | Розмір: 135 KiB |
|
Після Ширина: | Висота: | Розмір: 164 KiB |
|
Після Ширина: | Висота: | Розмір: 129 KiB |
|
Після Ширина: | Висота: | Розмір: 168 KiB |
|
Після Ширина: | Висота: | Розмір: 131 KiB |
@@ -0,0 +1,16 @@
|
||||
import js from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ["dist", "target", "src-tauri", "crates", "src/bindings.ts", "fixtures", "plugins", "test-results", "playwright-report"] },
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
plugins: { "react-hooks": reactHooks },
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -10,8 +10,10 @@
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<div id="splash" class="splash" data-tauri-drag-region>
|
||||
<svg class="splash-logo" viewBox="22 24 56 56" aria-hidden="true">
|
||||
<rect x="22" y="26" width="56" height="52" rx="12" fill="#D9582C" /><rect x="27" y="26" width="46" height="42" rx="9" fill="#1B1A1A" /><circle cx="44" cy="47.4" r="4.1" fill="none" stroke="#EAE7E0" stroke-width="2.7" /><rect x="54.3" y="42" width="2.8" height="10.5" fill="#EAE7E0" /><rect x="51.2" y="42" width="5.9" height="2.5" fill="#EAE7E0" /><rect x="51.2" y="50" width="9.4" height="2.5" fill="#EAE7E0" /><circle cx="55.7" cy="38.4" r="1.8" fill="#EAE7E0" />
|
||||
<svg class="splash-logo" viewBox="0 0 64 64" aria-hidden="true">
|
||||
<rect width="64" height="64" rx="15" fill="#0E0E10" />
|
||||
<circle cx="26" cy="32" r="11" fill="none" stroke="#FFFFFF" stroke-width="8" />
|
||||
<rect x="43" y="18" width="8" height="28" rx="1.5" fill="#FF4F1A" />
|
||||
</svg>
|
||||
<!-- "OpenIDEA" in Inter 500 as outlines: the web font loads late in dev and would swap in. -->
|
||||
<svg class="splash-wordmark" viewBox="0 -1984 9994 2478" role="img" aria-label="OpenIDEA">
|
||||
|
||||
@@ -38,11 +38,6 @@ eclipse = { downloadSources = true }
|
||||
references = { includeDecompiledSources = true }
|
||||
signatureHelp = { enabled = true }
|
||||
configuration = { updateBuildConfiguration = "automatic" }
|
||||
# Generated code (implement methods, getters, toString…) indents like the editor (`indent` above).
|
||||
format = { insertSpaces = true, tabSize = 4 }
|
||||
# Calls complete as `name()` with the caret inside and parameter info, not guessed arguments;
|
||||
# JDK internals (`sun.*`, `com.sun.*`, `jdk.*`) and AWT's `List` stay out of completion and auto-import.
|
||||
completion = { guessMethodArguments = "off", filteredTypes = ["java.awt.List", "com.sun.*", "sun.*", "jdk.*", "org.graalvm.*", "io.micrometer.shaded.*"] }
|
||||
|
||||
[language-servers.initialization-options.settings.java.import]
|
||||
# Keep Eclipse metadata (.project, .classpath, .settings) out of the project.
|
||||
|
||||
@@ -19,8 +19,6 @@ name = "kotlin-language-server"
|
||||
# Alternative: used only when the server above is not installed.
|
||||
fallback = true
|
||||
command = "kotlin-language-server"
|
||||
# Its bundled Kotlin compiler can't parse newer JDK versions ("25.0.4.1").
|
||||
max-java = 21
|
||||
root-markers = ["settings.gradle.kts", "settings.gradle", "build.gradle.kts", "build.gradle", "pom.xml"]
|
||||
install-hint = "brew install kotlin-language-server (https://github.com/fwcd/kotlin-language-server)"
|
||||
|
||||
|
||||
@@ -15,14 +15,6 @@ args = ["--stdio"]
|
||||
root-markers = ["pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile", "pyrightconfig.json"]
|
||||
install-hint = "pip install basedpyright (or: uv tool install basedpyright)"
|
||||
|
||||
# basedpyright defaults to "recommended", which flags unannotated attributes and
|
||||
# every unknown type. "standard" reports real problems; a project's own
|
||||
# `[tool.basedpyright]` / pyrightconfig.json still takes precedence.
|
||||
[language-servers.initialization-options.settings.basedpyright.analysis]
|
||||
typeCheckingMode = "standard"
|
||||
# Off whenever analysis settings are sent without it: `src/` layouts would stop resolving.
|
||||
autoSearchPaths = true
|
||||
|
||||
[[language-servers]]
|
||||
name = "pyright"
|
||||
# Alternative: used only when the server above is not installed.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "openidea",
|
||||
"private": true,
|
||||
"description": "An open-source IDE inspired by IntelliJ IDEA",
|
||||
"version": "0.1.21",
|
||||
"version": "0.1.18",
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
@@ -12,9 +12,9 @@
|
||||
"tauri": "tauri",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"lint": "oxlint",
|
||||
"format": "oxfmt",
|
||||
"typecheck": "tsrs --noEmit && tsrs -p tsconfig.node.json --noEmit && tsrs -p perf --noEmit && tsrs -p scripts --noEmit",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"typecheck": "tsc --noEmit && tsc -p tsconfig.node.json --noEmit && tsc -p perf --noEmit && tsc -p scripts --noEmit",
|
||||
"gen:bindings": "cargo test -p openidea --test export_bindings",
|
||||
"gen:theme-docs": "node scripts/theme/gen-docs.ts",
|
||||
"theme:import-intellij": "node scripts/theme/import-intellij-theme.ts",
|
||||
@@ -59,6 +59,7 @@
|
||||
"zustand": "^5.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@playwright/test": "^1.64.1",
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
@@ -69,11 +70,12 @@
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"@vitejs/plugin-react": "^6.0.2",
|
||||
"eslint": "^10.13.0",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"jsdom": "^30.1.3",
|
||||
"oxfmt": "^0.74.0",
|
||||
"oxlint": "^1.89.0",
|
||||
"tsrs": "^0.20.0-ts7.1.0-beta",
|
||||
"prettier": "^3.9.10",
|
||||
"typescript": "~6.0.3",
|
||||
"typescript-eslint": "^8.71.2",
|
||||
"vite": "^8.0.16",
|
||||
"vitest": "^5.0.5"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Linked, not inlined in index.html: release builds hash inline <style> blocks into the CSP,
|
||||
which voids style-src 'unsafe-inline' and blocks the editor's runtime-injected styles. */
|
||||
/* Start-up splash over the page until the window's launch project is open (platform/splash.ts).
|
||||
Until tokens load, the colours are the last theme's --bg-frame / --fg-muted that boot.js
|
||||
restored as --boot-*, else these built-in ones; the bar keeps the last --accent throughout. */
|
||||
Until tokens load, the colours are the last theme's --bg-frame / --fg-muted / --accent that
|
||||
boot.js restored as --boot-*, else these built-in ones. */
|
||||
/* Not on html: the canvas then takes body's (themed) background, which a fast resize shows before relayout. */
|
||||
body, .splash { background: var(--bg-frame, var(--boot-frame, #e9eaee)); }
|
||||
:root[data-theme="dark"] :is(body, .splash) { background: var(--bg-frame, var(--boot-frame, #26282c)); }
|
||||
@@ -33,13 +33,11 @@ body, .splash { background: var(--bg-frame, var(--boot-frame, #e9eaee)); }
|
||||
/* 15px Inter: 2048 units per em, the line box from ascender to descender. */
|
||||
.splash-wordmark { width: 73.2px; height: 18.15px; }
|
||||
.splash-bar { width: 120px; height: 2px; border-radius: 1px; overflow: hidden; background: rgb(127 127 127 / 0.18); }
|
||||
/* Fake progress: eases towards ~90% over the 4 s cap; hideSplash() fills it before fading out.
|
||||
The remembered accent comes first: tokens.css brings the theme's default --accent before
|
||||
settings restore a custom one, which would flash the default mid-load. */
|
||||
/* Fake progress: eases towards ~90% over the 4 s cap; hideSplash() fills it before fading out. */
|
||||
.splash-bar > i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: var(--boot-accent, var(--accent, #3871e1));
|
||||
background: var(--accent, var(--boot-accent, #3871e1));
|
||||
transform-origin: left;
|
||||
animation: splash-fill 4s cubic-bezier(0.1, 0.7, 0.3, 1) both;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ tauri-plugin-single-instance = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
tracing-appender = "0.2"
|
||||
tauri-specta = { version = "=2.0.0-rc.25", features = ["derive", "typescript"] }
|
||||
specta-typescript.workspace = true
|
||||
specta-typescript = "0.0.12"
|
||||
specta.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
|
До Ширина: | Висота: | Розмір: 2.6 KiB Після Ширина: | Висота: | Розмір: 4.1 KiB |
|
До Ширина: | Висота: | Розмір: 4.9 KiB Після Ширина: | Висота: | Розмір: 8.9 KiB |
|
До Ширина: | Висота: | Розмір: 718 B Після Ширина: | Висота: | Розмір: 877 B |
|
До Ширина: | Висота: | Розмір: 2.1 KiB Після Ширина: | Висота: | Розмір: 3.2 KiB |
|
До Ширина: | Висота: | Розмір: 2.9 KiB Після Ширина: | Висота: | Розмір: 4.5 KiB |
|
До Ширина: | Висота: | Розмір: 2.9 KiB Після Ширина: | Висота: | Розмір: 4.7 KiB |
|
До Ширина: | Висота: | Розмір: 5.5 KiB Після Ширина: | Висота: | Розмір: 10 KiB |
|
До Ширина: | Висота: | Розмір: 710 B Після Ширина: | Висота: | Розмір: 870 B |
|
До Ширина: | Висота: | Розмір: 5.8 KiB Після Ширина: | Висота: | Розмір: 11 KiB |
|
До Ширина: | Висота: | Розмір: 993 B Після Ширина: | Висота: | Розмір: 1.2 KiB |
|
До Ширина: | Висота: | Розмір: 1.5 KiB Після Ширина: | Висота: | Розмір: 2.1 KiB |
|
До Ширина: | Висота: | Розмір: 1.8 KiB Після Ширина: | Висота: | Розмір: 2.7 KiB |
|
До Ширина: | Висота: | Розмір: 1.1 KiB Після Ширина: | Висота: | Розмір: 1.4 KiB |
|
До Ширина: | Висота: | Розмір: 10 KiB Після Ширина: | Висота: | Розмір: 13 KiB |