3543: Parameter inlay hint separate from variable type inlay? #2876 r=matklad a=slyngbaek

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

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
This commit is contained in:
bors[bot] 2020-03-12 16:02:55 +00:00 committed by GitHub
commit d98a5fab46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 150 additions and 43 deletions

View file

@ -5,6 +5,12 @@ import { log } from "./util";
const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
export interface InlayHintOptions {
typeHints: boolean;
parameterHints: boolean;
maxLength: number | null;
}
export interface CargoWatchOptions {
enable: boolean;
arguments: string[];
@ -22,7 +28,8 @@ export class Config {
private static readonly requiresReloadOpts = [
"cargoFeatures",
"cargo-watch",
"highlighting.semanticTokens"
"highlighting.semanticTokens",
"inlayHints",
]
.map(opt => `${Config.rootSection}.${opt}`);
@ -149,8 +156,13 @@ 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 inlayHints(): InlayHintOptions {
return {
typeHints: this.cfg.get("inlayHints.typeHints") as boolean,
parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean,
maxLength: this.cfg.get("inlayHints.maxLength") as null | 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>; }