-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
inline values as decorators when debugging #16129
Conversation
nojvek
commented
Nov 28, 2016
•
edited
Loading
edited
- Write Tests.
- Figure out how to get words from lines.
- Figure out how to stop flashing on stepping because onDidContinue passes in null stack frame everytime
- Figure out how to registerDecorator from public API.
- setDecorators afterText doesn't work in python on lines with trailing ':'
- Merge as single commit
- Add screenshot
@isidorn Please take a look at the first iteration. |
I will do a code review and provide feedback in the code a bit later today, let me first try to answer your questions
|
|
@nojvek just to let you know that next week we have an endgame week - which means we take no new features. So it would be cool if we would try to land this feature together sometime this week. I have time on Thursday european time so I could try to wrap it up if something is still needed to be done then. Hope that works for you. |
Hi Isidor,
That's the plan. I'm going to send out a new iteration in a bit. Got some
bugs fixed. Fortunately I have Thursday and Friday off so can work on those
days full time.
…On Tue, Nov 29, 2016 at 12:50 AM, Isidor Nikolic ***@***.***> wrote:
@nojvek <https://github.com/nojvek> just to let you know that next week
we have an endgame week - which means we take no new features. So it would
be cool if we would try to land this feature together sometime this week. I
have time on Thursday european time so I could try to wrap it up if
something is still needed to be done then. Hope that works for you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVNavCqUQkZbj2KFJJmOs4GxZ8IpDks5rC-dvgaJpZM4K9bza>
.
|
Hi Isidor,
I'm in need of using proper ES6 Map and Set. Can I change the typescript
tsconfig to include the es2015.collection lib ? The version of electron
vscode uses seems to have Set and Map defined so it should be fine right?
…On Tue, Nov 29, 2016 at 1:08 AM, Noj Vek ***@***.***> wrote:
Hi Isidor,
That's the plan. I'm going to send out a new iteration in a bit. Got some
bugs fixed. Fortunately I have Thursday and Friday off so can work on those
days full time.
On Tue, Nov 29, 2016 at 12:50 AM, Isidor Nikolic ***@***.***
> wrote:
> @nojvek <https://github.com/nojvek> just to let you know that next week
> we have an endgame week - which means we take no new features. So it would
> be cool if we would try to land this feature together sometime this week. I
> have time on Thursday european time so I could try to wrap it up if
> something is still needed to be done then. Hope that works for you.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#16129 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AA-JVNavCqUQkZbj2KFJJmOs4GxZ8IpDks5rC-dvgaJpZM4K9bza>
> .
>
|
Not sure if we can use it in the core |
re #16129 (comment) - Where do you need those? In an extension and the main-body of source code? |
@jrieken main-body of source code |
For time being I've added a map-set.d.ts in the typings folder.
The reason why I'm having hard time with using {} as map is that, I can't
quite set hasOwnProtype or prototype as keys, since they are already
defined properties. A scope variable could be this special object keys.
I've tested with python and javascript. Inline values work well so far.
Need to iron out a couple of bugs and clean up the registerDecorator call.
Its 3am here, I'm heading to bed.
Regards.
…On Tue, Nov 29, 2016 at 2:57 AM, Isidor Nikolic ***@***.***> wrote:
@jrieken <https://github.com/jrieken> main-body of source code
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVJBgevvbkPN02UuoMHRmao2JwqYUks5rDAUjgaJpZM4K9bza>
.
|
That is not allowed 🙅♂️ We have some technical debt there but in essence it would make ES6 Maps/Sets also available in the editor/base layer which we program against older runtime targets that don't support ES6. You might have a local version of those definitions, we have done that in a few places but it is not nice. Also it seems you don't need that.
The fix for that is to not use |
I see. I'll undo the change and use collections helper. Thanks for the tip.
…On Tuesday, November 29, 2016, Johannes Rieken ***@***.***> wrote:
For time being I've added a map-set.d.ts in the typings folder.
That is not allowed 🙅♂️ We have some technical debt there but in
essence it would make ES6 Maps/Sets also available in the editor/base layer
which we program against older runtime targets that don't support ES6. You
might have a local version of those definitions, we have done that in a few
places
<https://github.com/Microsoft/vscode/blob/joh/xhr/src/vs/workbench/api/node/mainThreadHeapService.ts#L16>
but it is not nice. Also it seems you don't need that.
The reason why I'm having hard time with using {} as map is that, I can't
quite set hasOwnProtype or prototype as keys, since they are already
defined properties. A scope variable could be this special object keys.
The fix for that is to *not* use {} but Object.create(null) or the utils
defined in collections.ts
<https://github.com/Microsoft/vscode/blob/joh/xhr/src/vs/base/common/collections.ts#L23>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVBJqjfE4Bm6Hpwr4gVeV9IWdpuG4ks5rDA7MgaJpZM4K9bza>
.
|
Another question.
Having the inline values besides comments kind of looks weird. We match
against all words. Is it okay for me to getLineTokens for each line and
ignore the comment tokens?
…On Tuesday, November 29, 2016, Noj Vek ***@***.***> wrote:
I see. I'll undo the change and use collections helper. Thanks for the
tip.
On Tuesday, November 29, 2016, Johannes Rieken ***@***.***
***@***.***');>> wrote:
> For time being I've added a map-set.d.ts in the typings folder.
>
> That is not allowed 🙅♂️ We have some technical debt there but in
> essence it would make ES6 Maps/Sets also available in the editor/base layer
> which we program against older runtime targets that don't support ES6. You
> might have a local version of those definitions, we have done that in a few
> places
> <https://github.com/Microsoft/vscode/blob/joh/xhr/src/vs/workbench/api/node/mainThreadHeapService.ts#L16>
> but it is not nice. Also it seems you don't need that.
>
> The reason why I'm having hard time with using {} as map is that, I can't
> quite set hasOwnProtype or prototype as keys, since they are already
> defined properties. A scope variable could be this special object keys.
>
> The fix for that is to *not* use {} but Object.create(null) or the utils
> defined in collections.ts
> <https://github.com/Microsoft/vscode/blob/joh/xhr/src/vs/base/common/collections.ts#L23>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#16129 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AA-JVBJqjfE4Bm6Hpwr4gVeV9IWdpuG4ks5rDA7MgaJpZM4K9bza>
> .
>
|
That sounds like a decent workaround for now. So +1 |
Thanks.
Since getWordsRanges will mostly be creating a map from line tokens, makes
sense to move the function to TextEditorModel and expose as a public right?
I wonder how I can keep track of when the editor model has been changed so
I can invalidate the cached wordsRangesMap
…On Tuesday, November 29, 2016, Isidor Nikolic ***@***.***> wrote:
That sounds like a decent workaround for now. So +1
I believe tokenization is already dealing with words so it would be cool
if you could just get tokens and not do any additional word magic on a line
(which you are currently doing).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVGgu3fpsvG3wieJdo9zTakYtjemfks5rDF5hgaJpZM4K9bza>
.
|
@nojvek I would not move that to the TextEditorModel before I check with @alexandrudima. Will talk to him tomorrow in the office. You can add a listener to the editor on changeModel. Example |
Ok I have discussed this with @alexandrudima and there are concerns
Due to the above, this feature will be under a setting which by default is false. Once we have no more performance concerns we can lift this flag. @nojvek you do not have to worry about introducing this flag, I can just put it on top once we polish this pr. Also we need to put a limit on the line size and just do not compute anything for very long lines. Since currently we are matching the words on a line to a set of variables, we could also do it the other way around - match variables across a line. However this strategey does not work best for short lines which are the most common in practice. Thus I believe for starters we should just ignore long line. As for the word wrap issue - that is something we need to think about. Might not require immediate action. In a perfect world the debug extension would have a better ast understanding of the file - this knowledge would come from a language server but we currently do not have this. @weinand might know better if we plan to investigate into this any time in the future Due to all of the above we do not have to rush this feature in for November. But let's see how it goes. |
1. Currently we only process max 100 variable scopes for perf
2. Every scope value is trimmed to max 50 chrs and ellipses added if too
long.
3. Maximum length of inline decorator will be no more than 150. All this
are constants that can easily be changed.
4. Adding this under feature switch makes sense. We can get good feedback
from beta users.
5. Not sure how to handle word wrapping but I believe that will be more of
a decorator implementation fix.
6. This might seem like a small feature but it makes a significant
difference in debugging experience. I'll do my best to get something
performant and usable.
…On Wednesday, November 30, 2016, Isidor Nikolic ***@***.***> wrote:
Ok I have discussed this with @alexandrudima
<https://github.com/alexandrudima> and there are concerns
- The current implementation of putting decorations after text is
suboptimal and can hurt performance
- Going through each word on a line can be very performant for very
long lines
- What do we do for people that have word wrapping enabled. Via that
setting they have specifically enabled lines not to overflow over some
border.
Due to the above, this feature will be under a setting which by default is
false. Once we have no more performance concerns we can lift this flag.
@nojvek <https://github.com/nojvek> you do not have to worry about
introducing this flag, I can just put it on top once we polish this pr.
Also we need to put a limit on the line size and just do not compute
anything for very long lines. Since currently we are matching the words on
a line to a set of variables, we could also do it the other way around -
match variables across a line. However this strategey does not work best
for short lines which are the most common in practice. Thus I believe for
starters we should just ignore long line.
As for the word wrap issue - that is something we need to think about.
Might not require immediate action.
In a perfect world the debug extension would have a better ast
understanding of the file - this knowledge would come from a language
server but we currently do not have this. @weinand
<https://github.com/weinand> might know better if we plan to investigate
into this any time in the future
Due to all of the above we do not have to rush this feature in for
November. But let's see how it goes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVI5xW4VReDUiJb-0wcDlM-uSbHu4ks5rDXNigaJpZM4K9bza>
.
|
All those constraints make sense but we should introduce another one - the length of the editor line that is being processed. Because if the lenght of that line is quite large you will still go through each word and try to find it in the variables view, so some constraint needs to be added there. fyi I am on vacation on Friday but I plan to code review, merge this feature and try to wrap it up on Monday. |
Sounds good. I'll skip tokenization if line length is greater than 1000
chars.
@alexandrudima <https://github.com/alexandrudima>, on getLineTokens there
is a inaccurateTokens parameter. What does that do?
Also what is the perf impact of getLineTokens for every line in a file?
…On Thursday, December 1, 2016, Isidor Nikolic ***@***.***> wrote:
All those constraints make sense but we should introduce another one - the
length of the editor line that is being processed. Because if the lenght of
that line is quite large you will still go through each word and try to
find it in the variables view, so some constraint needs to be added there.
We can handle word wrapping later, not for version 1.
fyi I am on vacation on Friday but I plan to code review, merge this
feature and try to wrap it up on Monday.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVBCV2x9u3sMmcVhcHL4gq-pDCk7Yks5rDo6QgaJpZM4K9bza>
.
|
I've moved most of helper functions to debugInlineDecorators.ts where the core of logic really happens. Added 100% line, branch and function coverage for that file. I've tested on a bunch of different project types and it looks good so far. I've added a screenshot. Let me know if you need more changes. Its a nice sunny sunday, so I'll get back to this on Monday evening. Can't wait for this to get into nightly releases. |
@nojvek great work! And nice that you tested it in different projects! I have added comments in the commit directly. Let's move this feature out to the next release because there is no need for the rush and I would love the insiders to self host on this feature for a couple of weeks. This will also give us time to nicely adress the issues I brought up in the review. |
😳 still not able to see them.
May be paste the comments in conversation window.
Thanks.
…On Monday, December 5, 2016, Isidor Nikolic ***@***.***> wrote:
@nojvek <https://github.com/nojvek> ok that explains why you did not
react on my previous comment from a couple of days ago.
Here is the direct link to my comments, you should be able to nicely see
them
d36a042
<d36a042>
It should make insiders in about 8, 9 days when we wrap up our endgame.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVMLuN1JBGcxcweLy2U_1P_WPyIyoks5rFD2MgaJpZM4K9bza>
.
|
@nojvek you should be able to see them now, I made a mistake of not publishing them. Sorry for the misunderstanding! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed review feedback
@nojvek thanks for your replies - we are in the middle of the endgame so I will reply to your comments in a couple of days once the bugfixing fuss is over. I also need to consult with @alexandrudima for the editor side of things concerning some of the questions you have raised. |
Sounds good.
…On Tuesday, December 6, 2016, Isidor Nikolic ***@***.***> wrote:
@nojvek <https://github.com/nojvek> thanks for your replies - we are in
the middle of the endgame so I will reply to your comments in a couple of
days once the bugfixing fuss is over. I also need to consult with
@alexandrudima <https://github.com/alexandrudima> for the editor side of
things concerning some of the questions you have raised.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVHdcEN7I79xXexkpYxlJHkGb0e0yks5rFUnqgaJpZM4K9bza>
.
|
@nojvek feel free to ignore my comments from couple of days ago which I accidently only released yesterday |
@nojvek added some comments. Seems like it is in a good state, I would lke to merge it in some time next week and then I can look into improving some of the issues we raised in the discussion (end of line decorations, using timeouts, creating a tokenizer for tests). Most of the team is still busy with the endgame so I will sync with them next week for input on improving implentation of decorations |
Thanks for the update @isidor
…On Friday, December 9, 2016, Isidor Nikolic ***@***.***> wrote:
@nojvek <https://github.com/nojvek> added some comments. Seems like it is
in a good state, I would lke to merge it in some time next week and then I
can look into improving some of the issues we raised in the discussion (end
of line decorations, using timeouts, creating a tokenizer for tests). Most
of the team is still busy with the endgame so I will sync with them next
week for input on improving implentation of decorations
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVPLun1T_0uXSP1WeT0HqQB4tS7U5ks5rGV-WgaJpZM4K9bza>
.
|
@aeschli, In this instance managing the css on my own will probably be
almost the same as what setDecorators will do. The inline value decorators
are all after.contentText decorators which mean each of them will have a
corresponding ::after {..} css snippet.
That is why I wanted to add a registerDecoratorType api to the editor.
…On Fri, Dec 9, 2016 at 8:48 AM, Martin Aeschlimann ***@***.*** > wrote:
***@***.**** commented on this pull request.
------------------------------
In src/vs/editor/common/commonCodeEditor.ts
<#16129>:
> @@ -622,6 +622,10 @@ export abstract class CommonCodeEditor extends EventEmitter implements editorCom
return this.model.deltaDecorations(oldDecorations, newDecorations, this.id);
}
https://github.com/Microsoft/vscode/blob/master/src/vs/
editor/contrib/folding/common/foldingModel.ts#L71 is where folding
defines its decorations. Note that it manages the CSS itself. It just
passes in the name of the CSS in inlineClassName. You can also do
before/after images & text the same way using beforeContentClassName/
afterContentClassName
If you do that (manage your own CSS) all you need to use deltaDecorators.
setDecoration got added for our extension host API, where the CSS is
managed by us (done in the CodeEditorService). If you want to use that API,
register your decoration type on the ICodeEditorService. No new API should
be required.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVGIb-yKbR95etGGRYAwJ7RtNoAa3ks5rGYZkgaJpZM4K9bza>
.
|
Hi @nojvek I was looking into mergin this in, the following would still be needed in order for me to do the merge
Other things I can polish up once we merge it in. Thanks a lot! |
Sounds good. I'll get on it.
@aeschli, what did we decide regarding registerDecorator API ? It should
auto register key when calling setDecorators?
Regards.
…On Wednesday, December 28, 2016, Isidor Nikolic ***@***.***> wrote:
Hi @nojvek <https://github.com/nojvek> I was looking into mergin this in,
the following would still be needed in order for me to do the merge
- As @aeschli <https://github.com/aeschli> mentioned here
<#16129 (comment)>
no new editor api needs to be added. So please use existing API
- Changes in the codeEditorServiceImpl.ts need to be moved to a
seperate PR
- merge your branch with latest from master and resolve conflicts
Other things I can polish up once we merge it in.
Thanks a lot!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVDuljVAsci0kX33wCg0RSfGFNjcZks5rMmhggaJpZM4K9bza>
.
|
My suggestion is that you register your decoration type using ICodeEditorService.registerDecorationType |
ping @nojvek just to check if there are some updates here? Just fyi If you are busy I can also work on this. |
@aeschli , codeEditorService is a private variable of codeEditor. It is not exposed. This is exactly what I am trying to do. ICodeEditor.registerDecorationType ends up calling ICodeEditorService.registerDecorationType Updated PR, as you recommend I am using ICodeEditorService.registerDecorationType I feel its worse solution than what we had before but gets the job done until vscode exposes a nicer api. I'm really not sure what you want me to do here. 😞 |
@nojvek To get hold of the codeEditorService, use service injection in the class you are: |
Whoa! Code injection dark magic.
Will give it a shot.
Is there any other major changes you need? I'd love to get this on this
week.
Will be on vacation until February.
Thanks.
…On Tue, Jan 10, 2017 at 4:52 PM Martin Aeschlimann ***@***.***> wrote:
@nojvek <https://github.com/nojvek> To get hold of the codeEditorService,
use service injection in the class you are:
Add
@ICodeEditorService codeEditorService: ICodeEditorService
to the constructor of the DebugEditorContribution
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVMd50pQQJzg0e9YHcZEkksubCtNcks5rRCfegaJpZM4K9bza>
.
|
@nojvek just checked the PR and no other major changes are needed - except the code injection Martin mentioned. Once that is in I will merge this in. Great work! 🍻 |
For perf reasons we only process max 100 scopes, lines longer than 500 chars are not processed, maximum decorator length is 150 chars and we store a wordRangesMap for current editor model for fast lookup. Since continue, step over, step in will send null stack frame followed quickly by a valid frame. We debounce removeDecorators. 100% LFB code coverage for debugInlineDecorators.ts. Tested inline decorators with python and javascript projects. Adding codeEditorService to debugEditorContribution through dependency injection.
Done. Just curious: Any chance someone can give me a brief overview of how vscode uses es6 decorators to make dependency injection work?
Am I correct to assume that the services are all singletons? i.e each of them is only instantiated once and then stored in a service registry somewhere ?
This is like adding the class instance to another registry as editor extensions/contributors ? In this sense if I create another class
vscode will instantiate my contribution, add to contributions registry and call its handler functions when editor change happens right? So with |
@nojvek added setting, started using set & map (since it is now ok to do this - we no longer support IE10) and did some polish on top. I also plan to look into restructuring the debugInlineValues.ts so it is a class and not a bunch of helper methods. I am also considering not showing inline values for lines after the current line that is focussed. |
Looks good. Thank you.
In the January release, This will be part of editor config right?
Can't wait to see this to completion.
…On Fri, Jan 13, 2017 at 9:44 AM Isidor Nikolic ***@***.***> wrote:
@nojvek <https://github.com/nojvek> added setting, started using set &
map (since it is now ok to do this - we no longer support IE10) and did
some polish on top. I also plan to look into restructuring the
debugInlineValues.ts so it is a class and not a bunch of helper methods. I
am also considering not showing inline values for lines after the current
line that is focussed.
6091d5d
<6091d5d>
24c9eba
<24c9eba>
db334b2
<db334b2>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16129 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVNbws0TEih9igNB44z872NZeZtT0ks5rR7gMgaJpZM4K9bza>
.
|
This can be set in settings > "debug.inlineValues": true. |
Wow!! Awesome work! |
@luminaxster since this feature made its first appearance in VS Code 1.9 (3 days ago) we do not yet have statistics. In addition this feature is not enabled by default because we are still working on it, so we do not expect widespread acceptance in this release. |