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
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,32 @@
"default": false,
"description": "Whether to send back detailed information from error logs for diagnostic purpose.",
"scope": "window"
},
"java.copilot.inspection.renderer": {
"type": "object",
"description": "How to display rewriting suggestions.",
"properties": {
"diagnostics": {
"type": "boolean",
"default": true,
"description": "Hints (Diagnostics)"
},
"guttericons": {
"type": "boolean",
"default": false,
"description": "Gutter Icons"
},
"codelenses": {
"type": "boolean",
"default": false,
"description": "Code Lenses"
},
"rulerhighlights": {
"type": "boolean",
"default": true,
"description": "Ruler Highlights (Scrollbar)"
}
}
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions src/copilot/inspect/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function registerCommands(copilot: InspectionCopilot, renderer: DocumentR
void commands.executeCommand('vscode.editorChat.start', {
autoSend: true,
message: `/fix ${problem.description}, maybe ${uncapitalize(solution)}`,
position: range?.start,
initialSelection: new Selection(range!.start, range!.start),
initialRange: new Range(range!.start, range!.start)
position: range.start,
initialSelection: new Selection(range.start, range.start),
initialRange: new Range(range.start, range.start)
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/copilot/inspect/render/DiagnosticRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class DiagnosticRenderer implements InspectionRenderer {
class InspectionDiagnostic extends Diagnostic {
public constructor(public readonly inspection: Inspection) {
const range = Inspection.getIndicatorRangeOfInspection(inspection.problem);
const severiy = inspection.severity.toUpperCase() === 'HIGH' ? DiagnosticSeverity.Information : DiagnosticSeverity.Hint;
const severiy = DiagnosticSeverity.Hint;
super(range, inspection.problem.description, severiy);
this.source = DIAGNOSTICS_GROUP;
}
Expand Down
3 changes: 3 additions & 0 deletions src/copilot/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export async function getIntersectionSymbolsOfRange(range: Range | Selection, do
}

export function getUnionRange(symbols: SymbolNode[]): Range {
if (symbols.length === 0) {
throw new Error("No symbols provided");
}
let result: Range = new Range(symbols[0].range.start, symbols[0].range.end);
for (const symbol of symbols) {
result = result.union(symbol.range);
Expand Down
4 changes: 4 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
vscode.commands.executeCommand("java.runtime");
});
}

if (isLlmApiReady()) {
activateCopilotInspection(context);
}
}

async function presentFirstView(context: vscode.ExtensionContext) {
Expand Down