From 5a884d7cba0adfef5e4cbd2a2ce1d019b4c70103 Mon Sep 17 00:00:00 2001 From: Vadim Lazuk Date: Wed, 25 Nov 2026 22:51:30 +0300 Subject: [PATCH] refactor(dotnet): remove the standalone .NET tool window (#5918) Removes the standalone .NET tool window, its stripe button and dotnet.show. NuGet package search / install / update / remove move to a bottom "NuGet Packages" tool window (stripe onUse) opened by dotnet.packages. Build / Restore / Clean / Test act on the project of the current context: the Project view's selected .csproj / .fsproj / .vbproj / .sln, else the active editor's project, else the solution (the NuGet-selected project without one); an unloaded workspace model is scanned once, shared between concurrent actions and the NuGet window, and retried after a failure. Build / Restore / Clean join the Project view context menu for project and solution files. Review fixes: the context target reads the workbench projectViewSelection() instead of importing the project-tree store; the NuGet window loads the model through the shared scan; the menu uses the same path helpers as the target resolution. Refs #5635 Co-authored-by: Inf1mum <8135225+Inf1mum@users.noreply.github.com> --- src/features/dotnet/DotnetView.tsx | 225 ------------------ .../{Dotnet.module.css => Nuget.module.css} | 0 src/features/dotnet/NugetView.tsx | 128 ++++++++++ src/features/dotnet/index.ts | 210 ++++++++-------- src/features/dotnet/store.test.ts | 124 ++++++++++ src/features/dotnet/store.ts | 137 +++++++++-- src/features/dotnet/target.test.ts | 86 +++++++ src/features/dotnet/target.ts | 40 ++++ src/features/dotnet/window.test.ts | 89 +++++++ src/platform/locales/text/en.json | 22 +- src/platform/locales/text/es.json | 8 +- src/platform/locales/text/fr.json | 8 +- src/platform/locales/text/ko.json | 8 +- src/platform/locales/text/pl.json | 8 +- src/platform/locales/text/pt.json | 8 +- src/platform/locales/text/ru.json | 19 +- src/platform/locales/text/tr.json | 19 +- src/platform/locales/text/zh-TW.json | 19 +- src/platform/locales/text/zh.json | 19 +- 19 files changed, 770 insertions(+), 407 deletions(-) delete mode 100644 src/features/dotnet/DotnetView.tsx rename src/features/dotnet/{Dotnet.module.css => Nuget.module.css} (100%) create mode 100644 src/features/dotnet/NugetView.tsx create mode 100644 src/features/dotnet/target.test.ts create mode 100644 src/features/dotnet/target.ts create mode 100644 src/features/dotnet/window.test.ts diff --git a/src/features/dotnet/DotnetView.tsx b/src/features/dotnet/DotnetView.tsx deleted file mode 100644 index 13c1493fd0..0000000000 --- a/src/features/dotnet/DotnetView.tsx +++ /dev/null @@ -1,225 +0,0 @@ -import { executeAction } from "@/platform/actions"; -import { useState } from "react"; -import { useProject } from "@/platform/project"; -import { useTx } from "@/platform/i18n"; -import { Button, Input } from "@/ui"; -import { useDotnet } from "./store"; -import styles from "./Dotnet.module.css"; - -export function DotnetView() { - const s = useDotnet(); - const tx = useTx(); - const root = useProject((state) => state.project?.root ?? ""); - const relative = (path: string) => (root && path.startsWith(root + "/") ? path.slice(root.length + 1) : path); - const [versions, setVersions] = useState>({}); - const results = new Map(); - for (const p of s.found) results.set(p.id, [...new Set([...(results.get(p.id) ?? []), p.version])]); - const project = s.model.projects.find((p) => p.path === s.selected); - const action = (id: string, arg?: unknown) => void executeAction(`dotnet.${id}`, arg); - return ( -
-
- - {s.busy && } -
- {s.error && ( -
- {s.error} -
- )} - {s.model.errors?.map((error) => ( -
- {tx("Project evaluation failed")} - {error} -
- ))} - {s.model.solutions.map((solution) => ( -
- {solution.path.split("/").at(-1)} - {solution.projects.map((path) => ( - - ))} -
- ))} - - {project && ( - <> -
- - -
-
- {["build", "restore", "clean"].map((op) => ( - - ))} -
-
- {tx("Project references")} - {project.references.map((path) => ( - - ))} -
-
- {tx("NuGet packages")} - -
{ - e.preventDefault(); - action("search", { query: s.query }); - }} - > - useDotnet.setState({ query: e.target.value })} - /> - -
-
    - {[...results].map(([id, available]) => { - const version = available.includes(versions[id] ?? "") ? versions[id]! : available[0]!; - return ( -
  • - {id} - - - -
  • - ); - })} -
-
    - {s.packages.map((p) => ( -
  • - - {p.id} {p.version} {p.transitive ? tx("Transitive") : ""} - - {!p.transitive && ( - <> - - - - )} -
  • - ))} -
-
- {project.test && ( -
- {tx("Tests")} -
- - -
- {project.runner !== "vstest" && !project.trx && ( -
- {tx("Install the TRX reporting extension to show MTP results in the test panel.")} - -
- )} -
    - {s.tests.map((test) => ( -
  • - {test} - -
  • - ))} -
-
- )} - - )} - {s.output && ( -
- {tx("Output")} -
{s.output}
-
- )} -
- ); -} diff --git a/src/features/dotnet/Dotnet.module.css b/src/features/dotnet/Nuget.module.css similarity index 100% rename from src/features/dotnet/Dotnet.module.css rename to src/features/dotnet/Nuget.module.css diff --git a/src/features/dotnet/NugetView.tsx b/src/features/dotnet/NugetView.tsx new file mode 100644 index 0000000000..f69dc3f4ad --- /dev/null +++ b/src/features/dotnet/NugetView.tsx @@ -0,0 +1,128 @@ +/** + * NuGet tool window: the selected .NET project's packages, with search and + * install / update / remove. The package management that used to live in the + * standalone .NET tool window (#5635). + */ +import { useEffect, useState } from "react"; +import { executeAction } from "@/platform/actions"; +import { useTx } from "@/platform/i18n"; +import { Button, Input } from "@/ui"; +import { ensureDotnetModel, useDotnet } from "./store"; +import styles from "./Nuget.module.css"; + +export function NugetView() { + const s = useDotnet(); + const tx = useTx(); + const [versions, setVersions] = useState>({}); + const results = new Map(); + for (const p of s.found) results.set(p.id, [...new Set([...(results.get(p.id) ?? []), p.version])]); + const project = s.model.projects.find((p) => p.path === s.selected); + const action = (id: string, arg?: unknown) => void executeAction(`dotnet.${id}`, arg); + // The workspace scan used to run when the standalone .NET window opened; without it the + // window shows no project to manage packages for. + useEffect(() => { + void ensureDotnetModel(); + }, []); + return ( +
+
+ + {s.busy && } +
+ {s.error && ( +
+ {s.error} +
+ )} + + {project && ( + <> +
{ + e.preventDefault(); + action("search", { query: s.query }); + }} + > + useDotnet.setState({ query: e.target.value })} + /> + +
+
    + {[...results].map(([id, available]) => { + const version = available.includes(versions[id] ?? "") ? versions[id]! : available[0]!; + return ( +
  • + {id} + + + +
  • + ); + })} +
+
    + {s.packages.map((p) => ( +
  • + + {p.id} {p.version} {p.transitive ? tx("Transitive") : ""} + + {!p.transitive && ( + <> + + + + )} +
  • + ))} +
+ + )} + {s.output && ( +
+ {tx("Output")} +
{s.output}
+
+ )} +
+ ); +} diff --git a/src/features/dotnet/index.ts b/src/features/dotnet/index.ts index ae2c85f271..7136f63a95 100644 --- a/src/features/dotnet/index.ts +++ b/src/features/dotnet/index.ts @@ -1,7 +1,7 @@ import { registerActions } from "@/platform/actions"; import { useProject } from "@/platform/project"; -import { registerToolWindow, toolWindowService } from "@/workbench/contributions"; -import { DotnetView } from "./DotnetView"; +import { lazyComponent } from "@/ui"; +import { registerMenuGroup, registerToolWindow, toolWindowService } from "@/workbench/contributions"; import { buildDotnet, cancelDotnet, @@ -15,111 +15,123 @@ import { searchPackages, selectDotnet, } from "./store"; +import { isDotnetProjectPath, isDotnetSolutionPath } from "./target"; + +const NUGET = "nuget"; export function activate() { - const offWindow = registerToolWindow({ - id: "dotnet", - title: ".NET", - icon: "file-csharp", - anchor: "right", - stripe: "onUse", - component: DotnetView, - }); - const show = () => toolWindowService().show("dotnet", true); - const offActions = registerActions([ - { - id: "dotnet.show", - title: ".NET Workspace", - category: "Build", - when: "projectOpen", - run: () => { - show(); - return reloadDotnet(); + const disposers = [ + registerToolWindow({ + id: NUGET, + title: "NuGet Packages", + icon: "library", + anchor: "bottom", + // Listed under the stripe's "…" until first opened: most projects are not .NET ones. + stripe: "onUse", + order: 29, + component: lazyComponent(() => import("./NugetView").then((m) => m.NugetView)), + }), + registerActions([ + { + id: "dotnet.reload", + title: "Reload .NET Workspace", + category: "Build", + when: "projectOpen", + run: () => reloadDotnet(), }, - }, - { - id: "dotnet.reload", - title: "Reload .NET Workspace", - category: "Build", - when: "projectOpen", - run: () => reloadDotnet(), - }, - { id: "dotnet.cancel", title: "Cancel .NET Operation", category: "Build", run: () => cancelDotnet() }, - { - id: "dotnet.select", - title: "Select .NET Project", - category: "Build", - hidden: true, - run: ({ arg }) => { - const a = arg as { path: string; configuration?: string; framework?: string }; - return selectDotnet(a.path, a.configuration, a.framework); + { id: "dotnet.cancel", title: "Cancel .NET Operation", category: "Build", run: () => cancelDotnet() }, + { + id: "dotnet.select", + title: "Select .NET Project", + category: "Build", + hidden: true, + run: ({ arg }) => { + const a = arg as { path: string; configuration?: string; framework?: string }; + return selectDotnet(a.path, a.configuration, a.framework); + }, }, - }, - ...(["build", "restore", "clean"] as const).map((op) => ({ - id: `dotnet.${op}`, - title: op === "build" ? "Build .NET Project" : op === "restore" ? "Restore .NET Project" : "Clean .NET Project", - category: "Build", - when: "projectOpen", - run: () => buildDotnet(op), - })), - { - id: "dotnet.packages", - title: "Refresh NuGet Packages", - category: "Build", - when: "projectOpen", - run: () => listPackages(), - }, - { - id: "dotnet.search", - title: "Search NuGet Packages", - category: "Build", - hidden: true, - run: ({ arg }) => { - const a = arg as { query: string; exact?: boolean }; - return searchPackages(a.query, a.exact); + ...(["build", "restore", "clean"] as const).map((op) => ({ + id: `dotnet.${op}`, + title: op === "build" ? "Build .NET Project" : op === "restore" ? "Restore .NET Project" : "Clean .NET Project", + category: "Build", + when: "projectOpen", + run: ({ arg }: { arg?: unknown }) => buildDotnet(op, arg), + })), + { + id: "dotnet.packages", + title: "Refresh NuGet Packages", + category: "Build", + when: "projectOpen", + run: () => { + toolWindowService().show(NUGET, true); + return listPackages(); + }, }, - }, - { - id: "dotnet.packageChange", - title: "Change NuGet Package", - category: "Build", - hidden: true, - run: ({ arg }) => { - const a = arg as { id: string; version: string | null }; - return changePackage(a.id, a.version); + { + id: "dotnet.search", + title: "Search NuGet Packages", + category: "Build", + hidden: true, + run: ({ arg }) => { + const a = arg as { query: string; exact?: boolean }; + return searchPackages(a.query, a.exact); + }, }, - }, - { - id: "dotnet.discover", - title: "Discover .NET Tests", - category: "Run", - when: "projectOpen", - run: () => discoverTests(), - }, - { - id: "dotnet.test", - title: "Run .NET Tests", - category: "Run", - when: "projectOpen", - run: async ({ arg }) => { - await runTests(typeof arg === "string" ? arg : undefined); + { + id: "dotnet.packageChange", + title: "Change NuGet Package", + category: "Build", + hidden: true, + run: ({ arg }) => { + const a = arg as { id: string; version: string | null }; + return changePackage(a.id, a.version); + }, }, - }, - { - id: "dotnet.installTrx", - title: "Install TRX reporting", - category: "Build", - when: "projectOpen", - run: () => installTrx(), - }, - ]); - const offProject = useProject.subscribe((s, old) => { - if (s.project?.root !== old.project?.root) resetDotnet(); - }); + { + id: "dotnet.discover", + title: "Discover .NET Tests", + category: "Run", + when: "projectOpen", + run: () => discoverTests(), + }, + { + id: "dotnet.test", + title: "Run .NET Tests", + category: "Run", + when: "projectOpen", + run: async ({ arg }) => { + await runTests(typeof arg === "string" ? arg : undefined); + }, + }, + { + id: "dotnet.installTrx", + title: "Install TRX reporting", + category: "Build", + when: "projectOpen", + run: () => installTrx(), + }, + ]), + useProject.subscribe((s, old) => { + if (s.project?.root !== old.project?.root) resetDotnet(); + }), + // #5635: build / restore / clean act on the right-clicked solution or project. + registerMenuGroup({ + id: "dotnet.project", + menus: ["projectView"], + order: 45, + items: (_menu, { paths, dirs }) => { + const path = paths.length === 1 && !dirs?.[0] ? paths[0]! : null; + if (!path || !(isDotnetProjectPath(path) || isDotnetSolutionPath(path))) return []; + return [ + { kind: "action", action: "dotnet.build", arg: path }, + { kind: "action", action: "dotnet.restore", arg: path }, + { kind: "action", action: "dotnet.clean", arg: path }, + ]; + }, + }), + ]; return () => { resetDotnet(); - offProject(); - offActions(); - offWindow(); + disposers.reverse().forEach((d) => d()); }; } diff --git a/src/features/dotnet/store.test.ts b/src/features/dotnet/store.test.ts index 2206bb4dcf..9b05bc1000 100644 --- a/src/features/dotnet/store.test.ts +++ b/src/features/dotnet/store.test.ts @@ -3,6 +3,7 @@ import { buildDotnet, cancelDotnet, discoveredTests, + discoverTests, packageList, reloadDotnet, resetDotnet, @@ -11,6 +12,7 @@ import { } from "./store"; import * as platform from "@/platform/dotnet"; import { useProject } from "@/platform/project"; +import { EditorService, provideEditorService, provideProjectViewSelection } from "@/workbench/contributions"; afterEach(() => { resetDotnet(); @@ -192,3 +194,125 @@ describe("real dotnet discovery output", () => { ]); }); }); + +describe("acting on the context before the model was ever loaded (#5635)", () => { + const path = "/repo/src/App/App.csproj"; + const project: platform.DotnetProject = { + path, + name: "App", + frameworks: ["net9.0"], + configurations: ["Debug"], + references: [], + packages: [], + test: true, + runner: "vstest", + adapter: "mstest", + trx: false, + }; + let offSelection = () => {}; + const selectInProjectView = (...paths: string[]) => { + offSelection(); + offSelection = provideProjectViewSelection(() => paths); + }; + const previousProject = useProject.getState().project; + + beforeEach(() => { + useProject.setState({ project: { root: "/repo" } as NonNullable }); + // A fresh session: the Project view shows a source file, that file is open in the editor. + selectInProjectView("/repo/src/App/Program.cs"); + provideEditorService({ activePath: () => "/repo/src/App/Program.cs" } as unknown as EditorService); + }); + + afterEach(() => { + offSelection(); + provideEditorService(undefined as unknown as EditorService); + useProject.setState({ project: previousProject }); + }); + + it("loads the workspace once, then builds the project of the active editor's file", async () => { + const scan = vi.spyOn(platform, "dotnetWorkspace").mockResolvedValue({ projects: [project], solutions: [] }); + vi.spyOn(platform, "evaluateProject").mockResolvedValue(project); + const command = vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await buildDotnet("build"); + + expect(scan).toHaveBeenCalledTimes(1); + expect(command).toHaveBeenCalledWith( + ["build", path, "--configuration", "Debug", "--framework", "net9.0"], + "/repo/src/App", + expect.any(AbortSignal), + ); + }); + + it("shares one workspace load between concurrent context actions", async () => { + const scan = vi.spyOn(platform, "dotnetWorkspace").mockResolvedValue({ projects: [project], solutions: [] }); + vi.spyOn(platform, "evaluateProject").mockResolvedValue(project); + vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await Promise.all([buildDotnet("build"), buildDotnet("build")]); + + expect(scan).toHaveBeenCalledTimes(1); + }); + + it("discovers the tests of the context without a loaded model", async () => { + vi.spyOn(platform, "dotnetWorkspace").mockResolvedValue({ projects: [project], solutions: [] }); + const command = vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await discoverTests(); + + expect(command).toHaveBeenCalledWith( + expect.arrayContaining(["--list-tests"]), + "/repo/src/App", + expect.any(AbortSignal), + ); + }); + + it("builds a project selected in the Project view without loading the model", async () => { + selectInProjectView(path); + const scan = vi.spyOn(platform, "dotnetWorkspace"); + const command = vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await buildDotnet("build"); + + expect(scan).not.toHaveBeenCalled(); + expect(command).toHaveBeenCalledWith( + ["build", path, "--configuration", "Debug"], + "/repo/src/App", + expect.any(AbortSignal), + ); + }); + + it("scans once and stays a no-op in a workspace without .NET projects", async () => { + const scan = vi.spyOn(platform, "dotnetWorkspace").mockResolvedValue({ projects: [], solutions: [] }); + const command = vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await buildDotnet("build"); + await buildDotnet("build"); + + expect(scan).toHaveBeenCalledTimes(1); + expect(command).not.toHaveBeenCalled(); + }); + + it("retries the workspace load on the next action after a failed scan", async () => { + const scan = vi + .spyOn(platform, "dotnetWorkspace") + .mockRejectedValueOnce(new Error("scan failed")) + .mockResolvedValue({ projects: [project], solutions: [] }); + vi.spyOn(platform, "evaluateProject").mockResolvedValue(project); + const command = vi.spyOn(platform, "dotnet").mockResolvedValue(""); + + await buildDotnet("build"); + expect(useDotnet.getState().error).toContain("scan failed"); + expect(scan).toHaveBeenCalledTimes(1); + + await buildDotnet("build"); + + expect(scan).toHaveBeenCalledTimes(2); + expect(useDotnet.getState().error).toBe(""); + expect(command).toHaveBeenCalledWith( + ["build", path, "--configuration", "Debug", "--framework", "net9.0"], + "/repo/src/App", + expect.any(AbortSignal), + ); + }); +}); diff --git a/src/features/dotnet/store.ts b/src/features/dotnet/store.ts index 041002b6de..1dc9421bed 100644 --- a/src/features/dotnet/store.ts +++ b/src/features/dotnet/store.ts @@ -6,11 +6,14 @@ import { evaluateProject, dotnetTestArgs, jsonOutput, + type DotnetProject, type DotnetWorkspace, } from "@/platform/dotnet"; import { dirname, useProject } from "@/platform/project"; import type { RunConfig } from "@/platform/ipc"; import { tx } from "@/platform/i18n"; +import { maybeEditorService, projectViewSelection } from "@/workbench/contributions"; +import { contextDotnetTarget, isDotnetProjectPath, isDotnetSolutionPath } from "./target"; export interface Package { id: string; @@ -47,14 +50,80 @@ const initial: State = { export const useDotnet = create(() => initial); let controller: AbortController | undefined; let generation = 0; +/** The workspace scan a context action starts when the model was never loaded; concurrent calls share it (#5635). */ +let contextScan: Promise | undefined; export function resetDotnet() { generation++; controller?.abort(); + contextScan = undefined; useDotnet.setState(initial); } export const selectedProject = () => useDotnet.getState().model.projects.find((p) => p.path === useDotnet.getState().selected); +/** + * The .NET project or solution of the current context (#5635): an explicit file (the + * Project view context menu), else the Project view's selected `.csproj` / `.sln`, else + * the project of the active editor's file, else the solution — or, in a workspace with + * no solution, the project selected in the NuGet window. + */ +async function contextTarget(arg?: unknown): Promise { + if (typeof arg === "string" && arg) return arg; + const resolve = () => { + return ( + contextDotnetTarget({ + selected: projectViewSelection(), + editorFile: maybeEditorService()?.activePath() ?? null, + model: useDotnet.getState().model, + }) ?? + (useDotnet.getState().selected || null) + ); + }; + // A selected `.csproj` / `.sln` resolves without the model. Otherwise a fresh + // session may never have scanned the workspace yet (#5635): load it once + // instead of silently doing nothing. A workspace without .NET stays a no-op + // after that single scan, and a selected file never triggers one. + const target = resolve(); + if (target) return target; + const { model } = useDotnet.getState(); + if (model.projects.length || model.solutions.length || !useProject.getState().project?.root) return null; + await ensureDotnetModel(); + return resolve(); +} + +/** + * Loads the workspace model unless it is loaded: the NuGet window on mount and the context + * actions share one scan (#5635), so opening the window while an action resolves its target + * does not scan twice. + */ +export async function ensureDotnetModel(): Promise { + const { model } = useDotnet.getState(); + if (model.projects.length || model.solutions.length || !useProject.getState().project?.root) return; + const scan = (contextScan ??= Promise.resolve(reloadDotnet())); + try { + await scan; + } finally { + // A failed scan must not disable the context actions for the rest of the + // session (#5635): drop it so the next caller starts a new one. A scan + // that completed finds the model loaded — or, in a workspace without + // .NET, no error — and keeps its single-scan no-op. + if (contextScan === scan) { + const { model, error } = useDotnet.getState(); + if (error && !model.projects.length && !model.solutions.length) contextScan = undefined; + } + } +} + +/** The context's target as an evaluated project: a solution has no single project, so the selected one stands in. */ +async function contextProject(): Promise { + const target = await contextTarget(); + const s = useDotnet.getState(); + const path = target && !isDotnetSolutionPath(target) ? target : s.selected; + const known = s.model.projects.find((p) => p.path === path); + if (known || !path) return known ?? null; + return isDotnetProjectPath(path) ? evaluateProject(path, s.configuration, "") : null; +} + async function task(work: (signal: AbortSignal) => Promise>) { controller?.abort(); const current = ++generation; @@ -133,27 +202,57 @@ export function selectDotnet(path: string, configuration?: string, framework?: s }); } -export function buildDotnet(operation: "build" | "restore" | "clean") { - const p = selectedProject(); - if (!p) return; +export async function buildDotnet(operation: "build" | "restore" | "clean", arg?: unknown) { + const target = await contextTarget(arg); + if (!target) return; + // A solution builds as a whole: `dotnet` takes the `.sln` directly, there is no + // project to re-evaluate afterwards. + if (isDotnetSolutionPath(target)) { + const { configuration } = useDotnet.getState(); + return task(async (signal) => ({ + output: await dotnet( + [ + operation, + target, + ...(operation === "restore" ? [`-p:Configuration=${configuration}`] : ["--configuration", configuration]), + ], + dirname(target), + signal, + ), + })); + } + const selected = selectedProject(); const { framework, configuration } = useDotnet.getState(); + // The selected project keeps its chosen configuration and framework; another + // project builds with its own defaults. + if (selected?.path !== target) + return task(async (signal) => { + const output = await dotnet([operation, target, "--configuration", "Debug"], dirname(target), signal); + const model = useDotnet.getState().model; + if (!model.projects.some((p) => p.path === target)) return { output }; + const project = await evaluateProject(target, "Debug", "", signal); + return { + output, + model: { ...model, projects: model.projects.map((item) => (item.path === target ? project : item)) }, + }; + }); return task(async (signal) => { const output = await dotnet( [ operation, - p.path, + target, ...(operation === "restore" ? [`-p:Configuration=${configuration}`] : ["--configuration", configuration, ...(framework ? ["--framework", framework] : [])]), ], - dirname(p.path), + dirname(target), signal, ); - const project = await evaluateProject(p.path, configuration, framework, signal); + const project = await evaluateProject(target, configuration, framework, signal); const model = useDotnet.getState().model; return { output, - model: { ...model, projects: model.projects.map((item) => (item.path === p.path ? project : item)) }, + model: { ...model, projects: model.projects.map((item) => (item.path === target ? project : item)) }, }; }); } @@ -285,23 +384,25 @@ export function discoveredTests(output: string): string[] { } return [...tests]; } -export function discoverTests() { - const p = selectedProject(); +export async function discoverTests() { + const p = await contextProject(); if (!p) return; const s = useDotnet.getState(); + const own = p.path === s.selected; + const framework = own ? s.framework : ""; + const configuration = own ? s.configuration : "Debug"; return task(async (signal) => { - const output = await dotnet( - dotnetTestArgs(p, s.framework, ["--list-tests"], s.configuration), - dirname(p.path), - signal, - ); + const output = await dotnet(dotnetTestArgs(p, framework, ["--list-tests"], configuration), dirname(p.path), signal); return { output, tests: discoveredTests(output) }; }); } -export function runTests(test?: string) { - const p = selectedProject(); +export async function runTests(test?: string) { + const p = await contextProject(); if (!p) return; const s = useDotnet.getState(); + const own = p.path === s.selected; + const framework = own ? s.framework : ""; + const configuration = own ? s.configuration : "Debug"; const method = test?.replace(/\(.*$/, "").trim(); const config: RunConfig = { id: `dotnet:${p.path}:tests`, @@ -316,8 +417,8 @@ export function runTests(test?: string) { debugAdapter: null, params: { project: p.path, - framework: s.framework, - configuration: s.configuration, + framework, + configuration, runner: p.runner, adapter: p.adapter, programArgs: "", diff --git a/src/features/dotnet/target.test.ts b/src/features/dotnet/target.test.ts new file mode 100644 index 0000000000..4aa87dc872 --- /dev/null +++ b/src/features/dotnet/target.test.ts @@ -0,0 +1,86 @@ +import { describe, expect, it } from "vitest"; +import { contextDotnetTarget, type DotnetTargetContext } from "./target"; + +const project = (path: string) => ({ path, name: path.split("/").at(-1) ?? path }); +const solution = (path: string, projects: string[]) => ({ path, projects }); + +const ctx = (over: Partial = {}): DotnetTargetContext => ({ + selected: [], + editorFile: null, + model: { projects: [], solutions: [] }, + ...over, +}); + +describe("the .NET target of the current context", () => { + it("builds the project file selected in the Project tool window", () => { + const c = ctx({ + selected: ["/repo/src/App/App.csproj"], + editorFile: "/repo/other/Program.cs", + model: { + projects: [project("/repo/src/App/App.csproj"), project("/repo/other/Other.csproj")], + solutions: [solution("/repo/Demo.sln", ["/repo/src/App/App.csproj"])], + }, + }); + expect(contextDotnetTarget(c)).toBe("/repo/src/App/App.csproj"); + }); + + it("builds the F# project or the solution selected in the Project tool window", () => { + expect(contextDotnetTarget(ctx({ selected: ["/repo/App.fsproj"] }))).toBe("/repo/App.fsproj"); + expect(contextDotnetTarget(ctx({ selected: ["/repo/Demo.sln"] }))).toBe("/repo/Demo.sln"); + expect(contextDotnetTarget(ctx({ selected: ["/repo/Demo.slnx"] }))).toBe("/repo/Demo.slnx"); + }); + + it("ignores a selection that is no .NET project or solution file", () => { + const c = ctx({ + selected: ["/repo/src/App/Program.cs", "/repo/README.md"], + editorFile: "/repo/src/App/Program.cs", + model: { + projects: [project("/repo/src/App/App.csproj")], + solutions: [solution("/repo/Demo.sln", ["/repo/src/App/App.csproj"])], + }, + }); + expect(contextDotnetTarget(c)).toBe("/repo/src/App/App.csproj"); + }); + + it("builds the project of the active editor's file, the deepest one when projects nest", () => { + const model = { + projects: [project("/repo/src/App/App.csproj"), project("/repo/src/App.Tests/App.Tests.csproj")], + solutions: [solution("/repo/Demo.sln", [])], + }; + expect(contextDotnetTarget(ctx({ editorFile: "/repo/src/App/Program.cs", model: structuredClone(model) }))).toBe( + "/repo/src/App/App.csproj", + ); + expect(contextDotnetTarget(ctx({ editorFile: "/repo/src/App.Tests/Unit.cs", model: structuredClone(model) }))).toBe( + "/repo/src/App.Tests/App.Tests.csproj", + ); + }); + + it("does not confuse a project directory with a longer sibling name", () => { + const model = { + projects: [project("/repo/src/App/App.csproj")], + solutions: [solution("/repo/Demo.sln", [])], + }; + expect(contextDotnetTarget(ctx({ editorFile: "/repo/src/AppOther/Program.cs", model }))).toBe("/repo/Demo.sln"); + }); + + it("falls back to the first solution when the editor file matches no project", () => { + const model = { + projects: [project("/repo/src/App/App.csproj")], + solutions: [solution("/repo/First.sln", ["/repo/src/App/App.csproj"]), solution("/repo/Second.sln", [])], + }; + expect(contextDotnetTarget(ctx({ editorFile: "/repo/notes.txt", model }))).toBe("/repo/First.sln"); + }); + + it("falls back to the first solution with neither a selection nor an editor file", () => { + const model = { + projects: [project("/repo/src/App/App.csproj")], + solutions: [solution("/repo/Demo.sln", [])], + }; + expect(contextDotnetTarget(ctx({ model }))).toBe("/repo/Demo.sln"); + }); + + it("finds nothing without a selection, an editor file or a solution", () => { + expect(contextDotnetTarget(ctx())).toBeNull(); + expect(contextDotnetTarget(ctx({ model: { projects: [project("/repo/App.csproj")], solutions: [] } }))).toBeNull(); + }); +}); diff --git a/src/features/dotnet/target.ts b/src/features/dotnet/target.ts new file mode 100644 index 0000000000..c722323782 --- /dev/null +++ b/src/features/dotnet/target.ts @@ -0,0 +1,40 @@ +/** + * Which .NET project or solution the current context means (#5635): the Project + * tool window's selected `.csproj` / `.fsproj` / `.sln`, else the project of the + * active editor's file, else the solution. The Project view context menu passes + * its file explicitly; build, restore, clean and test resolve what is left. + */ +import { dirname } from "@/platform/project"; + +export interface DotnetTargetContext { + /** Paths selected in the Project tool window, lead first. */ + selected: string[]; + /** The active editor's file, when one is open. */ + editorFile: string | null; + /** The discovered .NET workspace; only the paths matter here. */ + model: { + projects: Array<{ path: string }>; + solutions: Array<{ path: string }>; + }; +} + +export const isDotnetSolutionPath = (path: string) => /\.slnx?$/i.test(path); +export const isDotnetProjectPath = (path: string) => /\.(?:cs|fs|vb)proj$/i.test(path); + +/** The project of `file`: the deepest enclosing project directory, if any. */ +function projectOf(file: string, projects: DotnetTargetContext["model"]["projects"]) { + const around = projects + .filter((p) => file.startsWith(`${dirname(p.path)}/`)) + .sort((a, b) => dirname(b.path).length - dirname(a.path).length); + return around[0]?.path ?? null; +} + +export function contextDotnetTarget(ctx: DotnetTargetContext): string | null { + const picked = ctx.selected.find((p) => isDotnetProjectPath(p) || isDotnetSolutionPath(p)); + if (picked) return picked; + if (ctx.editorFile) { + const project = projectOf(ctx.editorFile, ctx.model.projects); + if (project) return project; + } + return ctx.model.solutions[0]?.path ?? null; +} diff --git a/src/features/dotnet/window.test.ts b/src/features/dotnet/window.test.ts new file mode 100644 index 0000000000..2aaa616bc7 --- /dev/null +++ b/src/features/dotnet/window.test.ts @@ -0,0 +1,89 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { getAction } from "@/platform/actions"; +import { + provideToolWindowService, + useContributions, + menuGroupItems, + type ToolWindowService, +} from "@/workbench/contributions"; +import { PROJECT_TYPES } from "@/ui/projectType"; +import { activate } from "./index"; +import * as store from "./store"; + +let dispose: () => void; + +beforeEach(() => { + dispose = activate(); +}); + +afterEach(() => { + dispose(); +}); + +describe("standalone .NET tool window removal", () => { + it("registers no .NET tool window (no C# stripe button)", () => { + expect(useContributions.getState().toolWindows.has("dotnet")).toBe(false); + }); + + it("registers no command that opens it", () => { + expect(getAction("dotnet.show")).toBeUndefined(); + }); + + it("keeps the workbench entry points for .NET operations", () => { + for (const id of [ + "dotnet.reload", + "dotnet.build", + "dotnet.restore", + "dotnet.clean", + "dotnet.packages", + "dotnet.search", + "dotnet.packageChange", + "dotnet.discover", + "dotnet.test", + "dotnet.installTrx", + ]) { + expect(getAction(id), id).toBeDefined(); + } + }); + + it("registers the NuGet tool window on the bottom stripe, listed only on use", () => { + const nuget = useContributions.getState().toolWindows.get("nuget"); + expect(nuget, "nuget").toBeDefined(); + expect(nuget!.anchor).toBe("bottom"); + expect(nuget!.stripe).toBe("onUse"); + }); + + it("dotnet.packages opens the NuGet window", async () => { + const show = vi.fn(); + provideToolWindowService({ show } as unknown as ToolWindowService); + const list = vi.spyOn(store, "listPackages").mockReturnValue(undefined); + await getAction("dotnet.packages")!.run({ ctx: {} }); + expect(show).toHaveBeenCalledWith("nuget", true); + expect(list).toHaveBeenCalled(); + }); + + it("offers Build / Restore / Clean for a solution or project file in the Project view context menu", () => { + const actions = (path: string) => + menuGroupItems("projectView", { paths: [path], dirs: [false] }).map((i) => + i.kind === "action" ? `${i.action} ${String(i.arg)}` : i.kind, + ); + expect(actions("/repo/src/App/App.csproj")).toEqual([ + "dotnet.build /repo/src/App/App.csproj", + "dotnet.restore /repo/src/App/App.csproj", + "dotnet.clean /repo/src/App/App.csproj", + "separator", + ]); + expect(actions("/repo/Demo.sln")).toEqual([ + "dotnet.build /repo/Demo.sln", + "dotnet.restore /repo/Demo.sln", + "dotnet.clean /repo/Demo.sln", + "separator", + ]); + expect(actions("/repo/src/App/Program.cs")).toEqual([]); + }); + + it("keeps .NET solutions and projects visible in the Project tool window's file tree", () => { + expect(PROJECT_TYPES.dotnet.markers.some((m) => m instanceof RegExp && m.test("App.csproj"))).toBe(true); + expect(PROJECT_TYPES.dotnet.markers.some((m) => m instanceof RegExp && m.test("App.sln"))).toBe(true); + }); +}); diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index 3952c07ce8..8f2c33def5 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -1744,7 +1744,6 @@ "Files left open are not restored the next time that project or a standalone file is opened.": "Files left open are not restored the next time that project or a standalone file is opened.", "Could not read .NET test results: {error}\n": "Could not read .NET test results: {error}\n", "Invalid TRX report": "Invalid TRX report", - ".NET Workspace": ".NET Workspace", "Reload .NET Workspace": "Reload .NET Workspace", "Cancel .NET Operation": "Cancel .NET Operation", "Select .NET Project": "Select .NET Project", @@ -1757,20 +1756,10 @@ "Discover .NET Tests": "Discover .NET Tests", "Run .NET Tests": "Run .NET Tests", "Install TRX reporting": "Install TRX reporting", - "Project references": "Project references", - "NuGet packages": "NuGet packages", - "Refresh packages": "Refresh packages", - "Search NuGet packages": "Search NuGet packages", - "Install / Update": "Install / Update", - "Versions": "Versions", - "Transitive": "Transitive", - "Run all tests": "Run all tests", - "Install the TRX reporting extension to show MTP results in the test panel.": "Install the TRX reporting extension to show MTP results in the test panel.", ".NET output exceeded the size limit": ".NET output exceeded the size limit", "Clean": "Clean", "Run test": "Run test", "Select a .NET project": "Select a .NET project", - "Project evaluation failed": "Project evaluation failed", "dotnet exited with code {0}": "dotnet exited with code {0}", "Microsoft.Testing.Platform was not found in the restored project.": "Microsoft.Testing.Platform was not found in the restored project.", "Open Maven Settings": "Open Maven Settings", @@ -4071,5 +4060,14 @@ "flutter --version did not answer in {root}.": "flutter --version did not answer in {root}.", "Flutter {framework}": "Flutter {framework}", "channel {channel}": "channel {channel}", - "Dart {dart}": "Dart {dart}" + "Dart {dart}": "Dart {dart}", + "NuGet Packages": "NuGet Packages", + "Refresh packages": "Refresh packages", + "Search NuGet packages": "Search NuGet packages", + "Install / Update": "Install / Update", + "Versions": "Versions", + "Transitive": "Transitive", + "Version": "Version", + "Search": "Search", + ".NET project": ".NET project" } diff --git a/src/platform/locales/text/es.json b/src/platform/locales/text/es.json index 828c93dcd6..476b5d0ebf 100644 --- a/src/platform/locales/text/es.json +++ b/src/platform/locales/text/es.json @@ -6115,5 +6115,11 @@ "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Este mensaje y los posteriores se eliminan, y los archivos que el agente modificó desde entonces vuelven a como estaban antes de enviarlo. El mensaje vuelve al cuadro de texto.", "This clears the entire conversation, puts the files the agent changed back as they were when the task started, and starts a fresh agent session with this message.": "Esto borra toda la conversación, devuelve los archivos que el agente modificó a como estaban al empezar la tarea e inicia una nueva sesión del agente con este mensaje.", "Resets in {resetIn}": "Se restablece en {resetIn}", - "Cannot paste {name}": "No se puede pegar {name}" + "Cannot paste {name}": "No se puede pegar {name}", + "NuGet Packages": "Paquetes NuGet", + "Refresh packages": "Actualizar paquetes", + "Search NuGet packages": "Buscar paquetes NuGet", + "Install / Update": "Instalar / actualizar", + "Versions": "Versiones", + "Transitive": "Transitivo" } diff --git a/src/platform/locales/text/fr.json b/src/platform/locales/text/fr.json index 0932716ba8..75b272e3a9 100644 --- a/src/platform/locales/text/fr.json +++ b/src/platform/locales/text/fr.json @@ -5758,5 +5758,11 @@ "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Ce message et les suivants sont supprimés, et les fichiers modifiés par l'agent depuis reviennent à leur état d'avant l'envoi. Le message revient dans la zone de saisie.", "This clears the entire conversation, puts the files the agent changed back as they were when the task started, and starts a fresh agent session with this message.": "Cela efface toute la conversation, remet les fichiers modifiés par l'agent dans leur état du début de la tâche et démarre une nouvelle session de l'agent avec ce message.", "Resets in {resetIn}": "Réinitialisation dans {resetIn}", - "Cannot paste {name}": "Impossible de coller {name}" + "Cannot paste {name}": "Impossible de coller {name}", + "NuGet Packages": "Packages NuGet", + "Refresh packages": "Actualiser les packages", + "Search NuGet packages": "Rechercher des packages NuGet", + "Install / Update": "Installer / mettre à jour", + "Versions": "Versions", + "Transitive": "Transitif" } diff --git a/src/platform/locales/text/ko.json b/src/platform/locales/text/ko.json index 89a7193110..40ea8640bf 100644 --- a/src/platform/locales/text/ko.json +++ b/src/platform/locales/text/ko.json @@ -6225,5 +6225,11 @@ "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "이 메시지와 이후 메시지가 제거되고, 그 이후 에이전트가 변경한 파일은 메시지를 보내기 전 상태로 돌아갑니다. 메시지는 입력란으로 돌아갑니다.", "This clears the entire conversation, puts the files the agent changed back as they were when the task started, and starts a fresh agent session with this message.": "전체 대화를 지우고, 에이전트가 변경한 파일을 작업 시작 시점의 상태로 되돌린 뒤, 이 메시지로 새 에이전트 세션을 시작합니다.", "Resets in {resetIn}": "{resetIn} 후 재설정", - "Cannot paste {name}": "{name}을(를) 붙여넣을 수 없습니다" + "Cannot paste {name}": "{name}을(를) 붙여넣을 수 없습니다", + "NuGet Packages": "NuGet 패키지", + "Refresh packages": "패키지 새로 고침", + "Search NuGet packages": "NuGet 패키지 검색", + "Install / Update": "설치 / 업데이트", + "Versions": "버전", + "Transitive": "전이" } diff --git a/src/platform/locales/text/pl.json b/src/platform/locales/text/pl.json index 568d22d451..cfb68f4845 100644 --- a/src/platform/locales/text/pl.json +++ b/src/platform/locales/text/pl.json @@ -5923,5 +5923,11 @@ "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Ta wiadomość i kolejne zostaną usunięte, a pliki zmienione od tego czasu przez agenta wrócą do stanu sprzed jej wysłania. Wiadomość wróci do pola tekstowego.", "This clears the entire conversation, puts the files the agent changed back as they were when the task started, and starts a fresh agent session with this message.": "To wyczyści całą rozmowę, przywróci pliki zmienione przez agenta do stanu z początku zadania i rozpocznie nową sesję agenta z tą wiadomością.", "Resets in {resetIn}": "Resetuje się za {resetIn}", - "Cannot paste {name}": "Nie można wkleić {name}" + "Cannot paste {name}": "Nie można wkleić {name}", + "NuGet Packages": "Pakiety NuGet", + "Refresh packages": "Odśwież pakiety", + "Search NuGet packages": "Szukaj pakietów NuGet", + "Install / Update": "Zainstaluj / zaktualizuj", + "Versions": "Wersje", + "Transitive": "Przechodnia" } diff --git a/src/platform/locales/text/pt.json b/src/platform/locales/text/pt.json index 65b7b0ab5b..4e39e716ff 100644 --- a/src/platform/locales/text/pt.json +++ b/src/platform/locales/text/pt.json @@ -5938,5 +5938,11 @@ "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Esta mensagem e as seguintes são removidas, e os arquivos que o agente alterou desde então voltam a como estavam antes do envio. A mensagem volta para a caixa de texto.", "This clears the entire conversation, puts the files the agent changed back as they were when the task started, and starts a fresh agent session with this message.": "Isso limpa toda a conversa, devolve os arquivos que o agente alterou a como estavam no início da tarefa e inicia uma nova sessão do agente com esta mensagem.", "Resets in {resetIn}": "Redefine em {resetIn}", - "Cannot paste {name}": "Não é possível colar {name}" + "Cannot paste {name}": "Não é possível colar {name}", + "NuGet Packages": "Pacotes NuGet", + "Refresh packages": "Atualizar pacotes", + "Search NuGet packages": "Pesquisar pacotes NuGet", + "Install / Update": "Instalar / atualizar", + "Versions": "Versões", + "Transitive": "Transitivo" } diff --git a/src/platform/locales/text/ru.json b/src/platform/locales/text/ru.json index 334955bea3..b434eefc46 100644 --- a/src/platform/locales/text/ru.json +++ b/src/platform/locales/text/ru.json @@ -8167,7 +8167,6 @@ "Open Container Log in Editor": "Открыть журнал контейнера в редакторе", "Could not read .NET test results: {error}\n": "Не удалось прочитать результаты тестов .NET: {error}\n", "Invalid TRX report": "Некорректный отчёт TRX", - ".NET Workspace": "Рабочая область .NET", "Reload .NET Workspace": "Перезагрузить рабочую область .NET", "Cancel .NET Operation": "Отменить операцию .NET", "Select .NET Project": "Выбрать проект .NET", @@ -8180,19 +8179,9 @@ "Discover .NET Tests": "Обнаружить тесты .NET", "Run .NET Tests": "Запустить тесты .NET", "Install TRX reporting": "Установить отчёты TRX", - "Project references": "Ссылки проекта", - "NuGet packages": "Пакеты NuGet", - "Refresh packages": "Обновить пакеты", - "Search NuGet packages": "Поиск пакетов NuGet", - "Install / Update": "Установить / Обновить", - "Versions": "Версии", - "Transitive": "Транзитивные", - "Run all tests": "Запустить все тесты", - "Install the TRX reporting extension to show MTP results in the test panel.": "Установите расширение для отчётов TRX, чтобы отображать результаты MTP на панели тестов.", ".NET output exceeded the size limit": "Вывод .NET превысил ограничение по размеру", "Clean": "Очистить", "Run test": "Запустить тест", - "Project evaluation failed": "Ошибка оценки проекта", "dotnet exited with code {0}": "Процесс dotnet завершился с кодом {0}", "Microsoft.Testing.Platform was not found in the restored project.": "Платформа Microsoft.Testing.Platform не найдена в восстановленном проекте.", "Open Maven Settings": "Открыть настройки Maven", @@ -10128,5 +10117,11 @@ "Roll Back to Here": "Откатить до этого места", "Couldn't roll back": "Не удалось откатить", "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Это сообщение и все последующие будут удалены, а файлы, изменённые агентом с тех пор, вернутся к состоянию до его отправки. Сообщение вернётся в поле ввода.", - "Resets in {resetIn}": "Сброс через {resetIn}" + "Resets in {resetIn}": "Сброс через {resetIn}", + "NuGet Packages": "Пакеты NuGet", + "Refresh packages": "Обновить пакеты", + "Search NuGet packages": "Поиск пакетов NuGet", + "Install / Update": "Установить / Обновить", + "Versions": "Версии", + "Transitive": "Транзитивные" } diff --git a/src/platform/locales/text/tr.json b/src/platform/locales/text/tr.json index 0b3f53c62c..1cf51531d3 100644 --- a/src/platform/locales/text/tr.json +++ b/src/platform/locales/text/tr.json @@ -1198,7 +1198,6 @@ "Files left open are not restored the next time that project or a standalone file is opened.": "Açık bırakılan dosyalar, proje veya bağımsız dosya yeniden açıldığında geri yüklenmez.", "Could not read .NET test results: {error}\n": ".NET test sonuçları okunamadı: {error}\n", "Invalid TRX report": "Geçersiz TRX raporu", - ".NET Workspace": ".NET Çalışma Alanı", "Reload .NET Workspace": ".NET Çalışma Alanını Yeniden Yükle", "Cancel .NET Operation": ".NET İşlemini İptal Et", "Select .NET Project": ".NET Projesi Seç", @@ -1211,20 +1210,10 @@ "Discover .NET Tests": ".NET Testlerini Keşfet", "Run .NET Tests": ".NET Testlerini Çalıştır", "Install TRX reporting": "TRX raporlamasını yükle", - "Project references": "Proje başvuruları", - "NuGet packages": "NuGet paketleri", - "Refresh packages": "Paketleri yenile", - "Search NuGet packages": "NuGet paketlerinde ara", - "Install / Update": "Yükle / Güncelle", - "Versions": "Sürümler", - "Transitive": "Geçişli", - "Run all tests": "Tüm testleri çalıştır", - "Install the TRX reporting extension to show MTP results in the test panel.": "MTP sonuçlarını test panelinde göstermek için TRX raporlama uzantısını yükleyin.", ".NET output exceeded the size limit": ".NET çıktısı boyut sınırını aştı", "Clean": "Temizle", "Run test": "Testi çalıştır", "Select a .NET project": "Bir .NET projesi seçin", - "Project evaluation failed": "Proje değerlendirmesi başarısız oldu", "dotnet exited with code {0}": "dotnet {0} çıkış koduyla sonlandı", "Microsoft.Testing.Platform was not found in the restored project.": "Geri yüklenen projede Microsoft.Testing.Platform bulunamadı.", "Open Maven Settings": "Maven Ayarlarını Aç", @@ -8785,5 +8774,11 @@ "Roll Back to Here": "Buraya Geri Al", "Couldn't roll back": "Geri alınamadı", "This message and the ones after it are removed, and the files the agent changed since go back to how they were before it was sent. The message returns to the composer.": "Bu mesaj ve sonrakiler kaldırılır; ajanın o zamandan beri değiştirdiği dosyalar mesaj gönderilmeden önceki hâline döner. Mesaj yazma alanına geri konur.", - "Resets in {resetIn}": "{resetIn} sonra sıfırlanır" + "Resets in {resetIn}": "{resetIn} sonra sıfırlanır", + "NuGet Packages": "NuGet Paketleri", + "Refresh packages": "Paketleri yenile", + "Search NuGet packages": "NuGet paketlerinde ara", + "Install / Update": "Yükle / Güncelle", + "Versions": "Sürümler", + "Transitive": "Geçişli" } diff --git a/src/platform/locales/text/zh-TW.json b/src/platform/locales/text/zh-TW.json index cb013eb90c..d46078e625 100644 --- a/src/platform/locales/text/zh-TW.json +++ b/src/platform/locales/text/zh-TW.json @@ -7651,7 +7651,6 @@ "Open Container Log in Editor": "在編輯器中開啟容器記錄", "Could not read .NET test results: {error}\n": "無法讀取 .NET 測試結果:{error}\n", "Invalid TRX report": "無效的 TRX 報告", - ".NET Workspace": ".NET 工作區", "Reload .NET Workspace": "重新載入 .NET 工作區", "Cancel .NET Operation": "取消 .NET 操作", "Select .NET Project": "選擇 .NET 專案", @@ -7664,19 +7663,9 @@ "Discover .NET Tests": "發現 .NET 測試", "Run .NET Tests": "執行 .NET 測試", "Install TRX reporting": "安裝 TRX 報告支援", - "Project references": "專案引用", - "NuGet packages": "NuGet 包", - "Refresh packages": "重新整理包清單", - "Search NuGet packages": "搜尋 NuGet 包", - "Install / Update": "安裝 / 更新", - "Versions": "版本", - "Transitive": "間接依賴", - "Run all tests": "執行所有測試", - "Install the TRX reporting extension to show MTP results in the test panel.": "安裝 TRX 報告擴充功能,以在測試面板中顯示 MTP 結果。", ".NET output exceeded the size limit": ".NET 輸出超過大小限制", "Clean": "清理", "Run test": "執行測試", - "Project evaluation failed": "專案求值失敗", "dotnet exited with code {0}": "dotnet 已結束,結束碼 {0}", "Microsoft.Testing.Platform was not found in the restored project.": "還原後的專案中未找到 Microsoft.Testing.Platform。", "Open Maven Settings": "開啟 Maven 設定", @@ -9316,5 +9305,11 @@ "Already in the project": "已在專案中", "{name} is inside the opened project, so its sources are already part of it.": "{name} 位於已開啟的專案內,其原始碼已屬於該專案。", "{name} has no pom.xml or Gradle build file. Attach it to this project as another root? Its source folders are detected automatically.": "{name} 沒有 pom.xml 或 Gradle 建置檔案。要將其作為另一個根附加到此專案嗎?其中的原始碼目錄會自動識別。", - "Resets in {resetIn}": "{resetIn} 後重設" + "Resets in {resetIn}": "{resetIn} 後重設", + "NuGet Packages": "NuGet 包", + "Refresh packages": "重新整理包清單", + "Search NuGet packages": "搜尋 NuGet 包", + "Install / Update": "安裝 / 更新", + "Versions": "版本", + "Transitive": "間接依賴" } diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index ad44edd830..a8b2948e4d 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -8269,7 +8269,6 @@ "Open Container Log in Editor": "在编辑器中打开容器日志", "Could not read .NET test results: {error}\n": "无法读取 .NET 测试结果:{error}\n", "Invalid TRX report": "无效的 TRX 报告", - ".NET Workspace": ".NET 工作区", "Reload .NET Workspace": "重新加载 .NET 工作区", "Cancel .NET Operation": "取消 .NET 操作", "Select .NET Project": "选择 .NET 项目", @@ -8282,19 +8281,9 @@ "Discover .NET Tests": "发现 .NET 测试", "Run .NET Tests": "运行 .NET 测试", "Install TRX reporting": "安装 TRX 报告支持", - "Project references": "项目引用", - "NuGet packages": "NuGet 包", - "Refresh packages": "刷新包列表", - "Search NuGet packages": "搜索 NuGet 包", - "Install / Update": "安装 / 更新", - "Versions": "版本", - "Transitive": "间接依赖", - "Run all tests": "运行所有测试", - "Install the TRX reporting extension to show MTP results in the test panel.": "安装 TRX 报告扩展,以在测试面板中显示 MTP 结果。", ".NET output exceeded the size limit": ".NET 输出超过大小限制", "Clean": "清理", "Run test": "运行测试", - "Project evaluation failed": "项目求值失败", "dotnet exited with code {0}": "dotnet 已退出,退出码 {0}", "Microsoft.Testing.Platform was not found in the restored project.": "还原后的项目中未找到 Microsoft.Testing.Platform。", "Open Maven Settings": "打开 Maven 设置", @@ -10383,5 +10372,11 @@ "flutter --version did not answer in {root}.": "{root} 中的 flutter --version 没有响应。", "Flutter {framework}": "Flutter {framework}", "channel {channel}": "渠道 {channel}", - "Dart {dart}": "Dart {dart}" + "Dart {dart}": "Dart {dart}", + "NuGet Packages": "NuGet 包", + "Refresh packages": "刷新包列表", + "Search NuGet packages": "搜索 NuGet 包", + "Install / Update": "安装 / 更新", + "Versions": "版本", + "Transitive": "间接依赖" }