question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reference codeLens action not working

See original GitHub issue

I’m trying to use the build in command for editor.action.showReferences and have it bound to a codeLens. But I can’t figure out, what I’m doing wrong.

[Trace - 12:51:43 AM] Received response 'codeLens/resolve - (25)' in 6ms.
Result: {
    "range": {
        "start": {
            "line": 380,
            "character": 8
        },
        "end": {
            "line": 381,
            "character": 50
        }
    },
    "data": {
        "codeLensType": "referenceCounter",
        "references": [
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 380,
                        "character": 8
                    },
                    "end": {
                        "line": 380,
                        "character": 16
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 117,
                        "character": 30
                    },
                    "end": {
                        "line": 117,
                        "character": 38
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 152,
                        "character": 35
                    },
                    "end": {
                        "line": 152,
                        "character": 43
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 157,
                        "character": 35
                    },
                    "end": {
                        "line": 157,
                        "character": 43
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 350,
                        "character": 35
                    },
                    "end": {
                        "line": 350,
                        "character": 43
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 363,
                        "character": 33
                    },
                    "end": {
                        "line": 363,
                        "character": 41
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 385,
                        "character": 25
                    },
                    "end": {
                        "line": 385,
                        "character": 33
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 388,
                        "character": 23
                    },
                    "end": {
                        "line": 388,
                        "character": 31
                    }
                }
            },
            {
                "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "range": {
                    "start": {
                        "line": 479,
                        "character": 16
                    },
                    "end": {
                        "line": 479,
                        "character": 24
                    }
                }
            }
        ],
        "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm"
    },
    "command": {
        "title": "9 references",
        "command": "editor.action.showReferences",
        "arguments": [
            {
                "$mid": 1,
                "path": "/home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                "scheme": "file"
            },
            {
                "line": 380,
                "character": 8
            },
            [
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 380,
                            "character": 8
                        },
                        "end": {
                            "line": 380,
                            "character": 16
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 117,
                            "character": 30
                        },
                        "end": {
                            "line": 117,
                            "character": 38
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 152,
                            "character": 35
                        },
                        "end": {
                            "line": 152,
                            "character": 43
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 157,
                            "character": 35
                        },
                        "end": {
                            "line": 157,
                            "character": 43
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 350,
                            "character": 35
                        },
                        "end": {
                            "line": 350,
                            "character": 43
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 363,
                            "character": 33
                        },
                        "end": {
                            "line": 363,
                            "character": 41
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 385,
                            "character": 25
                        },
                        "end": {
                            "line": 385,
                            "character": 33
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 388,
                            "character": 23
                        },
                        "end": {
                            "line": 388,
                            "character": 31
                        }
                    }
                },
                {
                    "uri": "file:///home/razze/Development/elm-spa-example/src/Page/Article/Editor.elm",
                    "range": {
                        "start": {
                            "line": 479,
                            "character": 16
                        },
                        "end": {
                            "line": 479,
                            "character": 24
                        }
                    }
                }
            ]
        ]
    }
}


This is the error that happens, when I click the code action. Screenshot from 2019-06-07 00-50-26

https://github.com/microsoft/vscode-languageserver-node/issues/210

https://github.com/elm-tooling/elm-language-server/blob/57550c1a0c95b74df3ecb71c98b261785a306c69/src/providers/codeLensProvider.ts#L79

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
Krzysztof-Cieslakcommented, Aug 8, 2019

Yes, this is pretty OK workaround… but I kinda believe this behaviour should be fixed here in vscode-languageclient. Number-of-references CodeLenses is a feature supported by whole bunch of popular plugins (C#, F#, Powershell, Go to just name a few) and every single one of them needs to implement some type of workaround

0reactions
angelozerrcommented, Mar 2, 2021

If we standardize this it must be more than a string ID to make it an explicit concept.

Yes sure it will require to specify ID + args command. It will give the capability to use standard structure for args on language server side. I think it can be a good idea.

And clients still need to announce which commands it supports.

Indeed and I think again it’s a good idea because for XML Language Server we do that with custom capability. If we have standard capability, it should be cleaner.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Codelens references not updating when making code ...
Codelens references are no longer updating as I change code within a different file. The only way to get them to update seems...
Read more >
Codelens references not showing in Visual Studio ... - MSDN
Go to Tools -> Options... -> Text Editor -> All Languages -> CodeLens, uncheck and check this option; Close all programs and clean...
Read more >
CodeLens not showing references - visual studio
Go to Tools -> Options -> Text Editor -> All Languages -> CodeLens then click the "Enable CodeLens" option if it is not...
Read more >
Code Lens - PHP Tools for Visual Studio Documentation
This feature can be disabled/enabled in user-scope setting php.codeLens.enabled . References & Implementations. Every PHP declaration is decorated with ...
Read more >
Language Server Protocol Specification - 3.17
Client Initiated Progress. Consider a client sending a textDocument/reference request to a server and the client accepts work done progress reporting on that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found