-
Notifications
You must be signed in to change notification settings - Fork 799
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
Enable software metrics #1331
Comments
@ThirtySomething can you explain why this can't be implemented using the generic CodeLens request (see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeLens) I do know that some metric tools for VS Code use that approach. |
Hello @dbaeumer , thank you for your comment. I lack knowledge about the architecture/parts that make up VSCode. My guess was that the desired function could be a part of the language server. As far as I understand, the server provides all language specific functions. I also assume that the calculation of code metrics could be somehow language specific. For example, there is no switch/case statement in Python, but there is for C/C++, C# and Java. Each language has its own syntactic and lexical properties. My idea was to build some kind of interface for metrics into the language server to provide the information for each client. Because each language has its own language server, parts of the code could possibly be reused to compute the metrics as well. The language server maintainer(s) could add this metrics information with less effort. If I am informed correctly, for example Eclipse also uses the language server. Is Eclipse also able to use the generic request you suggest? If so, that could be a good way to provide these metrics. |
I am not sure about Eclipse. You need to ask them whether they support CodeLens. But I think there is a high change that they do. |
Eclipse IDE integration for LSP (aka Eclipse LSP4E project) has had support for codelenses for more than 3 years now. See http://www.eclipse.org/community/eclipse_newsletter/2018/june/images/let_example.png for instance of how this looks. |
Note that LSP isn't really intended to spec the content of the various language assistance, but instead to specify the interactions and workflow that do happen when providing assistance for file edition. |
@mickaelistria @dbaeumer Thank you for the provided informations. What I understand is:
So I have to request the feature in the vscode-cpptools - the language server implementation for C/C++? Maybe there's again a misunderstanding from my side - in this case I'll be happy about any hint to get me in the right direction. Then this issue can be closed - I agree to @mickaelistria . |
I would like to propose software metrics for the Language Server. Possibly this is not the right place, then I apologize. Maybe I didn't understand something technical correctly, then I apologize for that as well.
Jim Wanner, the author of one of my favorite tools has ended his career as a software developer. With SourceMonitor, I was able to view various software metrics about source code. This is a great support to write better code. It is also a great help for restructuring and improving code. Unfortunately, there will be no further development for this tool.
So I had the idea that this could be a topic for the Language Server. The Language Server is available for many programming languages. Then no programming language specific plugin would be necessary, all languages could profit from a uniform interface.
A few metrics are easily implemented: The number of lines in the file, the number of lines of code, the number of comment lines, ... It gets more elaborate with the McCabe metric (cyclomatic complexity) or the branch depth. It is even more complex if this is to be done not only for a single file, but for a workspace. Then there are the average values and a maximum in addition to the previous values.
From my point of view this would be a great feature. Since I use VSCode very often, this would be enormously helpful in my daily work. I use VSCode with Pyhton, C/C++, C#, JavaScript, HTML and CSS, sometimes for Ruby and others.
What do you think about this, would it be possible?
Regards
Jochen
The text was updated successfully, but these errors were encountered: