Class ProjectFix
- Namespace
- RDCore.SDK.Extensibility.Diagnostics
- Assembly
- RDCore.SDK.dll
A change of the project that fixes a finding: what the project file (ProjectFile) is to say of the module the finding is in, or of the libraries the project references, which the language server writes in the project file of the workspace when the fix is taken.
public sealed record ProjectFix : IEquatable<ProjectFix>
- Inheritance
-
ProjectFix
- Implements
- Inherited Members
Remarks
An analyzer is not given the project file, and does not edit its text: it says what is to change (Changes), and the platform changes the project, writes its project file and loads the workspace the file then lists. The code action of such a fix is a command the language server runs (ChangeProject), which is offered only when every change can be made (ApplyTo(ProjectFile, Uri, ILibrarySource, out ProjectChange?)).
No change edits the text of a module: a module that is removed from the project keeps its file where it is, and is not loaded.
Properties
Changes
The changes, made in this order.
[JsonProperty("changes")]
public IReadOnlyList<ProjectChange> Changes { get; init; }
Property Value
ChangesBehavior
Whether the changes change what the code does, as removing a module whose code runs does. Such a fix is never one a client may apply without
showing it (LSP 3.17 CodeAction.isPreferred).
[JsonProperty("changesBehavior", DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool ChangesBehavior { get; init; }
Property Value
Title
What the code action that changes the project is called, in the language of the analyzer's messages: what the project file is to say, as
Reference the Excel library.
[JsonProperty("title")]
public string Title { get; init; }
Property Value
Methods
ApplyTo(ProjectFile, Uri, ILibrarySource, out ProjectChange?)
The project, with the changes made: each change of Changes, in order, to the project the one before it made.
public ProjectFile? ApplyTo(ProjectFile project, Uri module, ILibrarySource libraries, out ProjectChange? refused)
Parameters
projectProjectFileThe project the finding was made of.
moduleUriThe URI of the document the finding is in: the module a change of a module changes.
librariesILibrarySourceThe descriptions of the libraries a project can reference: what a reference that is added refers to.
refusedProjectChangeThe first change that cannot be made; null when every one can.
Returns
- ProjectFile
The changed project, which is the project itself when no change changes it; null when a change cannot be made, and none of them is.