Go To Definition functionality

SyntaxEditor for Windows Forms Forum

Posted 6 years ago by Alexnaldo Santos
Version: 18.1.0340
Avatar

Hi,

I would like to implement Go To Definition functionality.

 

Is it possible?How?

 

Thanks.

Comments (4)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Which syntax language are you using?  One of ours or a custom one of your own?


Actipro Software Support

Posted 6 years ago by Alexnaldo Santos
Avatar

C# using SyntaxEditor .NET Languages Add-on.

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Alexnaldo,

While we don't have anything built-in specifically for go to definition, it should be possible to implement it with the information we provide.  You could create a CSharpContextFactory and call its CreateContext method to get an IDotNetContext object back.  Then call that object's Resolve method to get a IResolverResultSet.  Look at the first result if there is one.  Each IResolverResult has an ITypeReference.  If there was a fully resolved result, this ITypeReference will be an ITypeDefinition.  ITypeDefinition has a SourceFileLocations collection that returns an ISourceFileLocation instance.  Each one of these consists of a string Key (which is generally a file path or document UniqueId GUID) and the NavigationOffset within that document.  By opening the related document and going to the NavigationOffset, you can achieve go to definition functionality.


Actipro Software Support

Posted 6 years ago by Alexnaldo Santos
Avatar

Thanks. I will try it!

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.