Parameter inlay hint separate from variable type inlay? #2876
Add setting to allow enabling either type inlay hints or parameter inlay hints or both. Group the the max inlay hint length option into the object. - Add a new type for the inlayHint options. - Add tests to ensure the inlays don't happen on the server side
This commit is contained in:
@@ -29,7 +29,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
|
||||
initializationOptions: {
|
||||
publishDecorations: !config.highlightingSemanticTokens,
|
||||
lruCapacity: config.lruCapacity,
|
||||
maxInlayHintLength: config.maxInlayHintLength,
|
||||
inlayHintOpts: config.inlayHintOpts,
|
||||
cargoWatchEnable: cargoWatchOpts.enable,
|
||||
cargoWatchArgs: cargoWatchOpts.arguments,
|
||||
cargoWatchCommand: cargoWatchOpts.command,
|
||||
|
||||
@@ -5,6 +5,11 @@ import { log } from "./util";
|
||||
|
||||
const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
|
||||
|
||||
export interface InlayHintOptions {
|
||||
displayType: string;
|
||||
maxLength: number;
|
||||
}
|
||||
|
||||
export interface CargoWatchOptions {
|
||||
enable: boolean;
|
||||
arguments: string[];
|
||||
@@ -149,8 +154,12 @@ export class Config {
|
||||
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
|
||||
get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
|
||||
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
|
||||
get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
|
||||
get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
|
||||
get inlayHintOpts(): InlayHintOptions {
|
||||
return {
|
||||
displayType: this.cfg.get("inlayHintOpts.displayType") as string,
|
||||
maxLength: this.cfg.get("inlayHintOpts.maxLength") as number,
|
||||
};
|
||||
}
|
||||
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
|
||||
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
|
||||
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
|
||||
|
||||
@@ -10,7 +10,7 @@ export function activateInlayHints(ctx: Ctx) {
|
||||
const maybeUpdater = {
|
||||
updater: null as null | HintsUpdater,
|
||||
onConfigChange() {
|
||||
if (!ctx.config.displayInlayHints) {
|
||||
if (ctx.config.inlayHintOpts.displayType === 'off') {
|
||||
return this.dispose();
|
||||
}
|
||||
if (!this.updater) this.updater = new HintsUpdater(ctx);
|
||||
|
||||
Reference in New Issue
Block a user