Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/plans/CSDEVKIT-PARITY-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Features users expect within the first day of use.
- [x] Editor decorations (green play button, red/green/skip indicators), spec `[TEST-STATUS-LENS]`
- [x] Expecto discovery, runs and debugging — `test-explorer-fsharp-frameworks.test.ts` (list paths with spaces and nesting; pass, fail with the expectation's message, `ptestCase` skipped) and `debug-test-expecto-e2e.test.ts`
- [x] FsCheck property tests run-verified — `test-explorer-fsharp-frameworks.test.ts` *FsCheck: a property that holds passes, a falsified one fails with its counterexample, a skipped one is skipped* (FsCheck.Xunit 3.6.0)
- [ ] The `fsharp` tag derived from the project's language instead of the test name (today a real Expecto id is untagged and a C# `PropertyTests` is tagged F#) — [#604](https://github.com/Nimblesite/SharpLsp/issues/604)
- [x] The `fsharp` tag derived from the project's language instead of the test name — [#604](https://github.com/Nimblesite/SharpLsp/issues/604); `test-language.ts` `projectLanguageOf` (the listing's project, else the nearest project file above the assembly), proven by `test-explorer-fsharp-frameworks.test.ts` (every Expecto and FsCheck row tagged), `test-explorer-frameworks.test.ts` (F# xUnit/NUnit/MSTest tagged, C# untagged) and `test-language.test.ts` (a C# `PropertyTests` stays C#). Close #604 only after the released binaries prove it.
- [x] Code coverage integration, spec `[TEST-COVERAGE]`

- [x] **P2.3: Build Integration**
Expand Down
7 changes: 4 additions & 3 deletions docs/plans/DEBUGGING-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,9 @@ waiting; a debug run never writes the result cache.
`dap-router.ts` `onChildGone` (idempotent), `dap-wire.ts:143` `watchDeath`,
`child-signal.ts:28` `signalChild`; tests `debug-adapter-startup.test.ts` (all seven
cases)
- [ ] Attach reliability: ≥95% success rate across 20 consecutive attach attempts — attach is
red (§4.3)
- [x] Attach reliability: ≥95% success rate across 20 consecutive attach attempts — each
attach pauses the live thread and detaches without killing the process; test
`debug-attach-reliability-e2e.test.ts` (20/20 locally on macOS ARM64)
- [ ] Full E2E test suite passes in CI on Linux x64, macOS ARM64, Windows x64

### 4.14 Fixed on this branch
Expand Down Expand Up @@ -789,7 +790,7 @@ Goal: Replace netcoredbg with a C# Tier 4 sidecar achieving full vsdbg parity. C
- [ ] Implement `attach`: `DbgShim.RegisterForRuntimeStartup` (race-free; no `0x80070057`)
- [ ] Implement attach-by-name: resolve PID then attach
- [ ] Implement child process auto-attach via `ICorDebugManagedCallback::CreateProcess`
- [ ] E2E test: reliable attach — 20 consecutive attaches succeed (regression for netcoredbg issue #205 scenario)
- [x] E2E test: reliable attach — 20 consecutive attaches succeed (regression for netcoredbg issue #205 scenario): `debug-attach-reliability-e2e.test.ts`

### 5.4 Full Breakpoint Implementation

Expand Down
2 changes: 1 addition & 1 deletion docs/plans/DIAGNOSTICS-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Full branch CI is not green. The normal release host, sidecars, packaged extensi
- [x] Prove unopened default Razor SDK components participate in workspace pulls, map CS0029 to the component source and clear after a compiler-verified disk repair.
- [x] Respect NoWarn, source suppressions, analyzer opt-out and effective severity without suppressing compiler errors.
- [x] Prove actual generated-source and global/project diagnostic errors remain visible at their owning project with a zero-length 0:0 range: real FS0084, CS5001 and generated CS0029 editor cases pass in the verified 61-case combined suite, with exact counts and SDK build oracles (8b325497, 57e4a445).
- [ ] Apply the NuGet restore gate before compiler workspace creation; surface restore failures honestly.
- [x] Apply the NuGet restore gate before compiler workspace creation; surface restore failures honestly — the failure names the SDK's own `error` lines (`WorkspaceRestore.cs` `RestoreErrors`); `WorkspaceRestoreGateTests` (C#: no workspace after a failed restore, the missing package named, a repair opens it) and `FSharpWorkspaceRestoreEndToEndTests.fs` (F#).
- [ ] Preserve F# FSharpLint/FSharp.Analyzers.SDK and SharpLsp static analyzer behavior.
- [x] Supply codeDescription URLs ([#343](https://github.com/Nimblesite/SharpLsp/issues/343)): each C# finding's descriptor `HelpLinkUri` and FSharpLint's per-rule page; F# compiler codes carry none.
- [x] Supply unnecessary tags where specified. — [DIAG-CATEGORIES-TAGS] (#390): `Unnecessary` and `Deprecated` from both sidecars, passed through by the host — `diagnostic_tags.rs`
Expand Down
7 changes: 6 additions & 1 deletion docs/plans/SIDECAR-LIFECYCLE-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ item and its required evidence are complete.
### 11.5 Endpoint leases and READY `[SIDECAR-PLAN-CHECKLIST-STARTUP]`

- [ ] Generate at least 64 unpredictable bits from the OS CSPRNG for every spawn attempt.
Progress: every MANAGER's endpoint now carries 64 `getrandom` bits (`launch.rs`
`endpoint_nonce`, test `endpoint_tokens_are_unpredictable_and_constant_length`); a fresh
nonce per restart lands with the per-generation endpoint item below.
- [ ] Include language, host PID, generation, and nonce in a length-bounded platform endpoint.
- [ ] Create/use a validated owner-only Unix runtime directory and keep socket mode `0600`.
- [ ] Keep `PipeOptions.CurrentUserOnly` and a single named-pipe server instance on Windows.
Expand Down Expand Up @@ -484,7 +487,9 @@ item and its required evidence are complete.
- [ ] Poison and restart when a written request cannot be drained within its 120s/600s budget.
- [ ] Distinguish clean EOF between frames from truncated length/payload EOF and classify the latter as
a protocol failure.
- [ ] Keep the 64MiB frame check before allocation in Rust and .NET.
- [x] Keep the 64MiB frame check before allocation in Rust and .NET — `transport.rs` `MAX_FRAME_LEN`
(test `rejects_oversized_frame_length`), `FramedTransport.cs` `MaxFrameLength` (tests
`ReadFrameAsync_rejects_oversized_length_prefix`, `WriteFrameAsync_rejects_oversized_payload`).
- [ ] Add a real wrong-ID scenario proving the stale response reaches neither current nor next caller.
- [ ] Add a real notification-before-response scenario proving both are delivered correctly.

Expand Down
6 changes: 5 additions & 1 deletion src/editors/vscode/src/test-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ class DebugRunTerminal implements vscode.Pseudoterminal {
this.writeEmitter.fire(this.buffered);
this.buffered = '';
}
// A run that ended before VS Code opened the terminal fired its close into
// the void: VS Code only listens once it has opened the pty. Close now, or
// the terminal outlives its run as a ghost beside the next one.
if (this.ended) this.closeEmitter.fire();
}

/** VS Code's notice that the USER disposed the terminal. */
Expand Down Expand Up @@ -146,7 +150,7 @@ class DebugRunTerminal implements vscode.Pseudoterminal {
public end(): void {
if (this.ended) return;
this.ended = true;
this.closeEmitter.fire();
if (this.opened) this.closeEmitter.fire();
}
}

Expand Down
19 changes: 11 additions & 8 deletions src/editors/vscode/src/test-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as vscode from 'vscode';
import { compareFrameworks, frameworkSummary, TFM_TAG_PREFIX } from './test-frameworks.js';
import type { FrameworkBuild, TestAssemblyListing, TestLocation } from './test-listing-model.js';
import { isExpectoTest, isFsCheckTest } from './test-targets.js';
import { projectLanguageOf } from './test-language.js';

/**
* Id prefix marking the row that explains WHY discovery failed. Error rows are
Expand Down Expand Up @@ -49,23 +49,25 @@ function rangeFor(context: ItemContext, fullName: string): vscode.Range | undefi
}

/**
* Build a TestItem for a fully-qualified name, tagging F# tests and, in a
* multi-targeted project, each framework it is built for ([NETFX-TEST-DISCOVERY]).
* Build a TestItem for a fully-qualified name, tagging the tests an `.fsproj`
* built (#604) and, in a multi-targeted project, each framework it is built for
* ([NETFX-TEST-DISCOVERY]).
*/
export function makeTestItem(
context: ItemContext,
fullName: string,
frameworks: readonly string[] = [],
fsharp = false,
): vscode.TestItem {
const parts = fullName.split('.');
const label = parts.at(-1) ?? fullName;
const item = context.controller.createTestItem(fullName, label, uriFor(context, fullName));
item.description = fullName;
item.range = rangeFor(context, fullName);
const fsharp = isExpectoTest(fullName) || isFsCheckTest(fullName) ? ['fsharp'] : [];
item.tags = [...fsharp, ...frameworks.map((each) => `${TFM_TAG_PREFIX}${each}`)].map(
(id) => new vscode.TestTag(id),
);
item.tags = [
...(fsharp ? ['fsharp'] : []),
...frameworks.map((each) => `${TFM_TAG_PREFIX}${each}`),
].map((id) => new vscode.TestTag(id));
return item;
}

Expand Down Expand Up @@ -131,6 +133,7 @@ export function makeAssemblyItem(
const builds = assembly.frameworks ?? [];
if (builds.length > 1) root.description = frameworkSummary(builds);
const frameworks = frameworksByTest(builds);
const fsharp = projectLanguageOf(assembly) === 'fsharp';
const namespaces = new Map<string, vscode.TestItem>();
const classes = new Map<string, vscode.TestItem>();
for (const fqn of assembly.names) {
Expand All @@ -148,7 +151,7 @@ export function makeAssemblyItem(
label: classLabel,
});
}
parent.children.add(makeTestItem(context, fqn, frameworks.get(fqn)));
parent.children.add(makeTestItem(context, fqn, frameworks.get(fqn), fsharp));
}
return root;
}
Expand Down
53 changes: 53 additions & 0 deletions src/editors/vscode/src/test-language.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* The language of the project that built a test assembly, so the Testing view
* tags every F# test `fsharp` — xUnit, NUnit, MSTest, Expecto and FsCheck alike
* — and no C# test, whatever the tests are called (#604).
*
* The project is the one the listing names, else the nearest project file above
* the assembly's output folder (`bin/<config>/<tfm>/`). Nothing found is
* `undefined`: the row is left untagged rather than guessed.
*
* Implements [TEST-EXPLORER].
*/

import * as fs from 'node:fs';
import { directoryOf, hasExtension, isProjectFile, joinPath } from './paths';
import type { TestAssemblyListing } from './test-listing-model.js';

/** A .NET project language a test can be written in. */
export type ProjectLanguage = 'fsharp' | 'csharp';

/** How many folders above the assembly a project file may sit (`bin/<config>/<tfm>`, plus RID). */
const MAX_LEVELS = 5;

/** The language of the project that built `assembly`, when one can be found. */
export function projectLanguageOf(assembly: TestAssemblyListing): ProjectLanguage | undefined {
const project = assembly.projectFile ?? nearestProject(directoryOf(assembly.path));
if (project === undefined) return undefined;
return hasExtension(project, '.fsproj') ? 'fsharp' : 'csharp';
}

/** The first project file in `dir` or the folders above it, within {@link MAX_LEVELS}. */
function nearestProject(dir: string): string | undefined {
let current = dir;
for (let level = 0; level <= MAX_LEVELS; level += 1) {
const found = projectFilesIn(current);
if (found.length > 0) return found.find((file) => hasExtension(file, '.fsproj')) ?? found[0];
const parent = directoryOf(current);
if (parent === current) return undefined;
current = parent;
}
return undefined;
}

/** The project files directly inside `dir`; none when it cannot be read. */
function projectFilesIn(dir: string): string[] {
try {
return fs
.readdirSync(dir)
.filter((name) => isProjectFile(name))
.map((name) => joinPath(dir, name));
} catch {
return [];
}
}
9 changes: 0 additions & 9 deletions src/editors/vscode/src/test-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ export function runCwd(): string | undefined {
return vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
}

/** True when a test name matches Expecto naming conventions. */
export function isExpectoTest(name: string): boolean {
return name.includes('Expecto') || name.includes('testCase') || name.includes('testList');
}

/** True when a test name matches FsCheck property-test conventions. */
export function isFsCheckTest(name: string): boolean {
return name.includes('FsCheck') || name.includes('Property');
}
/**
* The filter ids a run uses. "Run everything, nothing excluded" is how VS Code
* expresses ▶ on the root of the Testing view; passing NO filter then runs every
Expand Down
Loading