microsoft / ConcordExtensibilitySamples

Visual Studio Debug Engine Extensibility Samples
Other
122 stars 50 forks source link

IDmkClrExpressionCompiler.CompileExpression: wrong value in "Text" property of DkmLanguageExpression #29

Closed onor13 closed 7 years ago

onor13 commented 7 years ago

Hello, when implementing IDkmClrExpressionCompiler interface I found a strange behaviour in the CompileExpression method. The property “Text” of the DkmLanguageExpression (=first parameter of this method) sometimes doesn’t contain the desired information. For example, consider a string “R14” in a custom language. When I point the mouse between 1 and 4 in the debugging session, the "Text" property will only contain “R1”! Is there an Interface that I can implement to change what will be stored in the “Text” property or get access to the source code from CompileExpression method so I can parse it manually? Thank you.

gregg-miskelly commented 7 years ago

@onor13 the language service is responsible for deciding what expression is under the mouse cursor.

onor13 commented 7 years ago

Hello Gregg-Miskelly, do you know which part/interface(s) ? It seems strange to me, because my issue is with the debugging session: mouse hover to see the VALUE of a variable/token. It has nothing to do with mouse hover of IntelliSense or similar Language Service functionalities.

gregg-miskelly commented 7 years ago

@onor13 yup, this has nothing to do with putting up completion lists. But deciding what is the extend of an interesting identifier is a language-specific concept, and hence a language service is what decides what should be evaluated.

The hookup between the editor and language services is not something that I really understand. For C#, at least, the language service directly calls the debugger last time I looked (IVsDebugger.GetDataTipValue) but I am not sure if that is required, or if the editor will sometimes call that on the language service's behalf. In case it gives you some hints, I think this is the Roslyn code for it: https://github.com/dotnet/roslyn/blob/9d94537786ba0561cc1c55fbd298c82388e8a5af/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService%602.VsLanguageDebugInfo.cs#L406

onor13 commented 7 years ago

Thank you a lot Gregg, the Roslyn code does exactly was I was looking for.