Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add inlay hints setting #689

Merged
merged 2 commits into from
Sep 16, 2024
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
47 changes: 18 additions & 29 deletions doc/metals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -184,6 +184,7 @@ _ones that are sent and used by the server_
* |excludedPackages|
* |fallbackScalaVersion|
* |gradleScript|
* |inlayHints|
* |javaFormat.eclipseConfigPath|
* |javaFormat.eclipseProfile|
* |javaHome|
Expand All @@ -196,9 +197,6 @@ _ones that are sent and used by the server_
* |scalafixRulesDependencies|
* |scalafmtConfigPath|
* |serverProperties|
* |showImplicitArguments|
* |showImplicitConversionsAndClasses|
* |showInferredType|
* |superMethodLensesEnabled|
* |verboseCompilation|

Expand Down Expand Up @@ -348,6 +346,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 ~
Expand Down Expand Up @@ -472,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 ~
Expand Down Expand Up @@ -1124,7 +1113,7 @@ toggle_setting({setting})

Example usage: >

lua require("metals").toggle_setting("showImplicitArguments")
lua require("metals").toggle_setting("verboseCompilation")
<

*type_of_range()*
Expand Down
1 change: 1 addition & 0 deletions lua/metals/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ local valid_metals_settings = {
"excludedPackages",
"fallbackScalaVersion",
"gradleScript",
"inlayHints",
"javaFormat.eclipseConfigPath",
"javaFormat.eclipseProfile",
"javaHome",
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down