From c4e883ad912c9529ca238bddd7f2fb4d8ad6fb1d Mon Sep 17 00:00:00 2001 From: Giorgio Abelli Date: Sat, 14 Sep 2024 23:30:26 +0200 Subject: [PATCH 1/2] feat: add inlay hints setting --- doc/metals.txt | 16 ++++++++++++++++ lua/metals/config.lua | 1 + 2 files changed, 17 insertions(+) diff --git a/doc/metals.txt b/doc/metals.txt index e26a870..a83a946 100644 --- a/doc/metals.txt +++ b/doc/metals.txt @@ -184,6 +184,7 @@ _ones that are sent and used by the server_ * |excludedPackages| * |fallbackScalaVersion| * |gradleScript| + * |inlayHints| * |javaFormat.eclipseConfigPath| * |javaFormat.eclipseProfile| * |javaHome| @@ -348,6 +349,21 @@ Note: Setting this to a higher version than Metals currently supports won't work and you'll just get a warning. So don't be cheeky and think you can bump faster than Metals can by using this. +inlayHints *inlayHints* + +Type: table ~ +Default: {} ~ + +Table of inlay hints to enable. > + { + hintsInPatternMatch = { enable = true }, + implicitArguments = { enable = true }, + implicitConversions = { enable = true }, + inferredTypes = { enable = true }, + typeParameters = { enable = true }, + } +< + javaFormat.eclipseConfigPath *javaFormat.eclipseConfigPath* Type: string ~ diff --git a/lua/metals/config.lua b/lua/metals/config.lua index 982a4e1..7b10e96 100644 --- a/lua/metals/config.lua +++ b/lua/metals/config.lua @@ -119,6 +119,7 @@ local valid_metals_settings = { "excludedPackages", "fallbackScalaVersion", "gradleScript", + "inlayHints", "javaFormat.eclipseConfigPath", "javaFormat.eclipseProfile", "javaHome", From 345f3ea1c5bbd3a1c0f7cb15a241370940bfedf7 Mon Sep 17 00:00:00 2001 From: Giorgio Abelli Date: Mon, 16 Sep 2024 16:52:57 +0200 Subject: [PATCH 2/2] docs: drop references to old config keys --- doc/metals.txt | 31 ++----------------------------- tests/tests/config_spec.lua | 4 ++-- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/doc/metals.txt b/doc/metals.txt index a83a946..0280cc1 100644 --- a/doc/metals.txt +++ b/doc/metals.txt @@ -158,7 +158,7 @@ example below shows: > metals_config = require("metals").bare_config() metals_config.settings = { - showImplicitArguments = true, + verboseCompilation = true, excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" @@ -197,9 +197,6 @@ _ones that are sent and used by the server_ * |scalafixRulesDependencies| * |scalafmtConfigPath| * |serverProperties| - * |showImplicitArguments| - * |showImplicitConversionsAndClasses| - * |showInferredType| * |superMethodLensesEnabled| * |verboseCompilation| @@ -488,30 +485,6 @@ that it is installed. If you need to check what version you're currently using, you can use the |MetalsInfo| command. NOTE: that `latest.snapshot` is also available as a value to install whatever the latest snapshot is. -showImplicitArguments *showImplicitArguments* - -Type: boolean ~ -Default: false ~ - -When this option is enabled, each method that has implicit arguments has them -displayed as extra info in the hover. - -showImplicitConversionsAndClasses *showImplicitConversionsAndClasses* - -Type: boolean ~ -Default: false ~ - -When this option is enabled, each place where an implicit method or class is -used has it displayed as extra info in the hover. - -showInferredType *showInferredType* - -Type: boolean ~ -Default: false ~ - -When this option is enabled, each method that can have inferred types has them -displayed as extra info in the hover. - serverProperties *serverProperties* Type: table ~ @@ -1140,7 +1113,7 @@ toggle_setting({setting}) Example usage: > - lua require("metals").toggle_setting("showImplicitArguments") + lua require("metals").toggle_setting("verboseCompilation") < *type_of_range()* diff --git a/tests/tests/config_spec.lua b/tests/tests/config_spec.lua index a665e5c..702d26b 100644 --- a/tests/tests/config_spec.lua +++ b/tests/tests/config_spec.lua @@ -45,12 +45,12 @@ describe("config", function() it("should persist the config in cache", function() local bare_config = require("metals.setup").bare_config() bare_config.settings = { - showImplicitArguments = true, + verboseCompilation = true, } local valid_config = config.validate_config(bare_config, current_buf) - eq(valid_config.settings, { metals = { superMethodLensesEnabled = true, showImplicitArguments = true } }) + eq(valid_config.settings, { metals = { superMethodLensesEnabled = true, verboseCompilation = true } }) local cache = config.get_config_cache()