Skip to content

Adds editor options overloads to showTextDocument & vscode.diff#23641

Merged
jrieken merged 6 commits intomicrosoft:masterfrom
eamodio:feature-show-editor-options
Apr 25, 2017
Merged

Adds editor options overloads to showTextDocument & vscode.diff#23641
jrieken merged 6 commits intomicrosoft:masterfrom
eamodio:feature-show-editor-options

Conversation

@eamodio
Copy link
Contributor

@eamodio eamodio commented Mar 30, 2017

This PR hopefully addresses #10568
Also addresses a need I have with vscode.diff to have the same control (for GitLens)

@jrieken This is a first shot at this -- please let me know what you think. I added it as options so that it could be expanded later to allow for other editor options (but didn't want to go there at this stage).

@mention-bot
Copy link

@eamodio, thanks for your PR! By analyzing the history of the files in this pull request, we identified @alexandrudima and @jrieken to be potential reviewers.

@msftclas
Copy link

@eamodio, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

@jrieken
Copy link
Member

jrieken commented Mar 30, 2017

Check, in the middle of endgame this week. We have resources to jump on this starting next week

@jrieken jrieken self-assigned this Mar 30, 2017
@jrieken jrieken added this to the April 2017 milestone Mar 30, 2017
@eamodio
Copy link
Contributor Author

eamodio commented Mar 30, 2017

OK, thanks. I'll dig into the broken tests soon as well

@eamodio eamodio force-pushed the feature-show-editor-options branch from f789b62 to 9dd64f7 Compare April 9, 2017 15:12
@eamodio
Copy link
Contributor Author

eamodio commented Apr 9, 2017

@jrieken I resynced this with master and ran the test locally and I don't get any failures. Hopefully the builds will succeed now.

@eamodio
Copy link
Contributor Author

eamodio commented Apr 12, 2017

I see the failures now (in the integration tests), but I'm having trouble figuring out how to debug them. Any help would be appreciated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooo, if we add this new overload it should include column and also make it a type which we can document nicer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - Will do. Should I also allow any other editor options come through? I have it explicitly locked to just that set right now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the protocol/shape there should only be one signature and the calling side should do the argument construction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@jrieken
Copy link
Member

jrieken commented Apr 13, 2017

Please also rebase this on master to see if those tests still fail, they shouldn't. Then I wonder if we actually tackle #10568 here. There is also an ask to (1) know if an editor is pinned or not pinned and (2) an ask to change that after the fact. We should think about exposing this information on the editor, similar to viewColumn, and about allowing to change that property, similar to changing a selection. However, important is to know that there are embedded and other editors that cannot be pinned etc. Last, we should think of a better name than 'pinned'.

@eamodio
Copy link
Contributor Author

eamodio commented Apr 13, 2017

For a name instead of pinned -- how about the inverse - preview since I believe that's what its called in the docs (preview tab)?
Did you paste the wrong link (or am I missing something) because I thought this does address #10568.

As for exposing the information -- totally agree, I look into adding that. But for changing after the fact -- that feels less clear. Should you be able to go from something pinned to not pinned? Maybe so, but the UI currently doesn't provide a way for that direction (though an extension might have a good reason for it). What do you think?

Also can you elaborate on the last point about certain editors can't be pinned -- where would I find that, and would/should that be handled explicitly here?

@jrieken
Copy link
Member

jrieken commented Apr 13, 2017

Look here (#10568 (comment)) which is about making the transition. Basically turning an existing editor into a pinned (from a preview editor)

Also can you elaborate on the last point about certain editors can't be pinned

This is only an issue when the pinned-state is exposed as property. Similar to viewColumn is only applies to one the "big editors" not those of a peek view (find references) or the left of a diff editor

@eamodio
Copy link
Contributor Author

eamodio commented Apr 13, 2017

Ah got it -- going from unpinned --> pinned make perfect sense (was thinking that could just be handled by another call to showTextDocument, but something more explicit is probably best). Think it should be a 1-way deal, or also support going from pinned --> unpinned?

@eamodio eamodio force-pushed the feature-show-editor-options branch from 9dd64f7 to 1c92003 Compare April 13, 2017 18:49
@eamodio
Copy link
Contributor Author

eamodio commented Apr 13, 2017

I made the first set of changes -- didn't rename pinned yet until there is agreement on a new name.
Also haven't looked into adding pinned as a property yet.
Since we moved column into the options, I added column support to the diff command too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrieken I don't love this name, let me know what you think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe turning it around TextDocumentShowOptions or TextDocumentViewOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TextDocumentDisplayOptions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrieken I moved some of the data massaging into here, so that it could take the same ShowTextDocumentOptions (since I think you can technically call the proxy methods from inside an extension).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use the TypeConverter here but send proper data. Do all the massaging before calling a main-side method. Rule of thumb is that mainXYZ files shouldn't depend on extHostXZY files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue with that, is then we would need 2 "versions" of the TextDocument[Show|View|Display]Options -- one for the extensions with a column and one for the main-side with a position. Which is certainly doable, I was just trying to not have 2 types with almost the same fields. Are you fine with adding 2 types? And if so, where should the main-side one live and how should it be named to not cause confusion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two - one is API the other the DTO

@jrieken jrieken added api feature-request Request for new features or functionality labels Apr 14, 2017
@jrieken
Copy link
Member

jrieken commented Apr 24, 2017

@eamodio Can you go ahead and resolve the merge conflicts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe turning it around TextDocumentShowOptions or TextDocumentViewOptions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use the TypeConverter here but send proper data. Do all the massaging before calling a main-side method. Rule of thumb is that mainXYZ files shouldn't depend on extHostXZY files

@eamodio
Copy link
Contributor Author

eamodio commented Apr 24, 2017

@jrieken is a rebase/force push fine to resolve the conflicts or should I do it in a follow-on commit?

@jrieken
Copy link
Member

jrieken commented Apr 24, 2017

rebase/force push

That's OK for me

@eamodio
Copy link
Contributor Author

eamodio commented Apr 24, 2017

@jrieken Are you good with preview as the name rather than pinned (even though it is the inverse)?

Also see comments above

@jrieken
Copy link
Member

jrieken commented Apr 24, 2017

Yeah, let go with preview for now

@jrieken jrieken added this to the May 2017 milestone Apr 25, 2017
@jrieken jrieken removed this from the April 2017 milestone Apr 25, 2017
eamodio added 4 commits April 25, 2017 08:45
Moves column into the options
Removes overloads from the proxy
Changes pinned property to preview
Adds ITextDocumentShowOptions as main-side DTO
@eamodio eamodio force-pushed the feature-show-editor-options branch from 1c92003 to ca163e0 Compare April 25, 2017 13:33
@eamodio
Copy link
Contributor Author

eamodio commented Apr 25, 2017

@jrieken I've resolved the conflicts and made all the code review changes above

export interface TextDocumentShowOptions {
/**
* An optional view column in which the [editor](#TextEditor) should be shown. The default is the [one](#ViewColumn.One), other values are adjusted to be __Min(column, columnCount + 1)__.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow - your commit should have been blocked because that's a formatting issue...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

});

CommandsRegistry.registerCommand('_workbench.diff', function (accessor: ServicesAccessor, args: [URI, URI, string, string]) {
CommandsRegistry.registerCommand('_workbench.diff', function (accessor: ServicesAccessor, args: [URI, URI, string, string, vscode.TextDocumentShowOptions]) {
Copy link
Member

@jrieken jrieken Apr 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's dangerous to use the vscode-module here (actually everywhere outside the extension host) because these type actually don't exist. for interfaces it's OK because they disappear but using IEditorOption would have been better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see an IEditorOption -- there is IEditorOptions, but that interface doesn't have any of the fields. Are you suggesting adding them there? Or am I missing something?

@jrieken
Copy link
Member

jrieken commented Apr 25, 2017

Trying to understand why the test have failed...

pinned: true
};
} else {
options = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else cannot be unconditional because it will be hit when no second parameter is given. Add a check like typeof columnOrOptions === 'object'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@jrieken jrieken modified the milestones: April 2017, May 2017 Apr 25, 2017
@eamodio
Copy link
Contributor Author

eamodio commented Apr 25, 2017

I think the fall-through case was causing the test failures -- they all passed now! :)

@jrieken
Copy link
Member

jrieken commented Apr 25, 2017

Merging now. Thanks for this PR, for reacting to feedback.

@jrieken jrieken merged commit 7ecebac into microsoft:master Apr 25, 2017
@eamodio
Copy link
Contributor Author

eamodio commented Apr 25, 2017

@jrieken thank you!

@jrieken
Copy link
Member

jrieken commented Apr 25, 2017

fyi - I have made some minor tweak: align vscode.diff-options with showTextDocument, doc string, and I have renamed column to viewColumn so that it is aligned with the editor property. See: 9f01642, 936104d, and 779e7af

@jrieken jrieken added verification-needed Verification of issue is requested and removed verification-needed Verification of issue is requested labels Apr 25, 2017
@eamodio
Copy link
Contributor Author

eamodio commented Apr 25, 2017

Look great -- just had that 1 comment on a possible behavior change.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants