vscode-objectscript icon indicating copy to clipboard operation
vscode-objectscript copied to clipboard

F12/Go go Definition

Open SCanzano opened this issue 1 year ago • 1 comments
trafficstars

Maybe I'm asking for too much but here goes

  1. If I have
ClassMethod CreateTasks(pVerbose As %Boolean = 0) As %Status
{
  #dim tSC 			 	As %Status=$$$OK
  #dim eException 	 	As %Exception.AbstractException
  #dim tResult  		As %SQL.StatementResult
  Try {
   	New $Namespace
	Set tStatement=##class(%SQL.Statement).%New()
	$$$THROWONERROR(tSC,tStatement.%PrepareClassQuery("%SYS.Namespace","List"))
	Set tResult=tStatement.%Execute(0,1).%NextResult()
	For  {
		Quit:'tResult.%Next()
		If tResult.Nsp["%" Continue

and then hover over tResult on the last line it would be nice if it showed information about %SQL.Statement. I'd also like to place my cursor on tResult.Nsp, esp the tResult and press F12 to go to %SQL.Statement. Given that I have #dim tResult as %SQL.Statement I wish VS Code understood that it was defined by a class.

  1. If I have something like
/// Get the log data from <class>RC.CSP.Log</class>
Method GetLogs(Output tSC As %Status, pInfo As %ZEN.Auxiliary.QueryInfo) As %ResultSet
{
	#dim eException	As %Exception.AbstractException
	#dim tResult	As %SQL.StatementResult
	Try {
		Set pInfo.queryExecuted=0

while in the class RC.CSP.UI.Log I'd like to be able to hover or select RC.CSP.Log or the inner part of RC.CSP.Log

and see the class doc for RC.CSP.Log.

I'd also like to hover over or select the same text and press F12 to open the class.

I'm hoping the interaction model in VS code is IRIS gets called and the selected text is sent.. whereby we could parse the text and determine if what was selected, minus any of the decorators represents a class and if so allow me to go to the class.

But that might be pure wishful thinking.. but it is what I find myself doing all of the time wishing it would work.

SCanzano avatar Apr 11 '24 19:04 SCanzano

@SCanzano I hope you don't mind that I edited your issue to be more readable.

For the first issue, I'm not sure I understand your request. I copied that method into a class and verified that tResult is known by the Language Server to be a %SQL.StatementResult. You can check that by hovering over %Next() on the line above. If you want to go to %SQL.StatementResult, you can use "Go to Type Definition" on tResult.

The second request is already partially implemented. The vscode-objectscript extension provides a DocumentLink for class names within those tags so you can Ctrl(or Cmd on Mac)-Click on that link to open the class. There isn't any hover support though.

isc-bsaviano avatar Apr 11 '24 20:04 isc-bsaviano

Maybe for the first issue is I would like to hover over tResult and see the class doc for %SQL.StatementResult. Yes it is true for the line

tResult.%Next() I can hover over %next and it shows the method doc but if I hover over tResult I get nothing.

then for this line If tResult.Nsp["%" Continue

if I hover over tResult nothing happens either.

SCanzano avatar Apr 12 '24 12:04 SCanzano

and for the second issue. I see now .. I was not aware of that.

SCanzano avatar Apr 12 '24 13:04 SCanzano

but for the second issue. Consider if I have as class documentation

/// /// /// Set tSC=##class(RC.System.IPM).AddUserPortalFavoritesByRole("%All",1,1) ///

I cannot do CTRL-Click on RC.System.IPM and it would be great if I could do so.

SCanzano avatar Apr 12 '24 13:04 SCanzano

@SCanzano Thanks for clarifying. Since these are both Language Server related requests, I will create two issues in that report for you and close this once. The first issue should be possible to implement. The second I can try to add the DocumentLink for the class name inside the ##class() as well as <CLASS></CLASS> for description comments.

isc-bsaviano avatar Apr 12 '24 13:04 isc-bsaviano

@SCanzano Please follow the two Language Server issues for progress updates. Closing this as a duplicate.

isc-bsaviano avatar Apr 12 '24 13:04 isc-bsaviano

thanks much.

SCanzano avatar Apr 15 '24 15:04 SCanzano