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

[Feature request] Parameter name inlay hints #60

Open
lens0021 opened this issue Oct 23, 2023 · 9 comments · May be fixed by #169
Open

[Feature request] Parameter name inlay hints #60

lens0021 opened this issue Oct 23, 2023 · 9 comments · May be fixed by #169

Comments

@lens0021
Copy link

lens0021 commented Oct 23, 2023

PhpStorm provides the parameter name inlay hints:
image
The call of foo() function shows the names of parameters: foo and bar.

VS Code seems to provide the API of inlay hints, for example the below shows how rust-analyzer use inlay type hints.
image

@lens0021 lens0021 changed the title Parameter name inlay hints [Feature request] Parameter name inlay hints Oct 23, 2023
@BladeMF
Copy link
Contributor

BladeMF commented Oct 23, 2023

I can't see the hints in the second screeshot. Can you point them out?

@lens0021
Copy link
Author

lens0021 commented Oct 23, 2023

Sorry for confusing you. : &Path was the hint. But please see this instead: https://code.visualstudio.com/docs/typescript/typescript-editing#_inlay-hints

@BladeMF
Copy link
Contributor

BladeMF commented Oct 23, 2023

Oh wow, I didn't know that support appeared. You should create the issue in the main Phpactor repo. If you find the relevant section the LSP protocol you could try and do it yourself :-)

@lens0021
Copy link
Author

After searching, I've just found phpactor/phpactor#2138 and phpactor/phpactor#2139 were marked as completed. So I guess there are no blockers.

@dantleech
Copy link
Contributor

dantleech commented Oct 23, 2023

What's missing? They are disabled by default for performance reasons: https://phpactor.readthedocs.io/en/master/reference/configuration.html#language-server-worse-reflection-inlay-hints-enable

image

@dantleech
Copy link
Contributor

hmm, but doesn't work in code for some reason?

@BladeMF
Copy link
Contributor

BladeMF commented Oct 23, 2023

Yes, I was just going to say that.

@BladeMF
Copy link
Contributor

BladeMF commented Oct 23, 2023

The javascript ones work, so it must be something the LSP doesn't do. I wonder whether that has something to do with the client capabilities

"capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                }
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    }
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                },
                "contextSupport": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "workDoneProgress": true
        }
    },
    "initializationOptions": {},
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///var/www/iis/app",
            "name": "app"
        }
    ]

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint
I can't see the client capability property textDocument.inlayHint.

@zobo
Copy link
Collaborator

zobo commented Jan 4, 2025

The vscode-languageclient needs to be updated in the extension for this to work. And it will be as part of #169

@zobo zobo linked a pull request Jan 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants