Skip to content

Add command for opening InterSystems documents #1398

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

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

isc-bsaviano
Copy link
Contributor

This PR fixes #1379. The new Open InterSystems Document... command can be opened from the command palette and it provides a UI for browsing all files in the connected server-namespace. The user can either pick an item in the list, or type text into the filter box and press "Enter" to submit that. The UI should function very similarity to the built-in simple file dialog. I would like to assign a keybinding to this command, but I couldn't find a good one so I'm open to suggestions.

output

isc-rsingh
isc-rsingh previously approved these changes Jul 9, 2024
@isc-bsaviano
Copy link
Contributor Author

@isc-rsingh @gjsjohnmurray How do you feel about using a chord ask the keybinding for this? Ctrl+K Alt+O (Cmd+K Alt+O on Mac) is available. We could also overload Ctrl+K Shift+O (Cmd+K Shift+O on Mac), which is only use din the diff editor. This is the best that I could come up with ending with O.

@isc-rsingh
Copy link
Member

How about Ctrl+K Ctrl+O (Mac: Cmd+K Cmd+O) which seems easy to type and available.

@isc-bsaviano
Copy link
Contributor Author

That's taken on Windows

@isc-rsingh
Copy link
Member

Ugh. Now I see the semantics are different on Windows and Mac. On Mac, Cmd+O does both the open file and open folder semantics. While on Windows there are 2 separate keybindings, Ctrl+O for open file and the chord Ctrl+K Ctrl+O for open folder. I think the best available option is the chord Ctrl+K Ctrl+Shift+O and Mac Cmd+K Cmd+Shift+O?

@isc-bsaviano
Copy link
Contributor Author

I think Ctrl+K Alt+O is better because it's fewer keys but I'm not sure any of these are natural/easy to use.

@isc-rsingh
Copy link
Member

isc-rsingh commented Jul 10, 2024

My suggestion was based on the convenience of not lifting the finger off of Ctrl (or Cmd) when typing the 2nd part of the chord, which is why I preferred it over a chord that changes all the finger positions, but its not a huge difference. You could go with either and see if we get feedback.

@isc-bsaviano
Copy link
Contributor Author

That's a good point. Let's see what John thinks.

@gjsjohnmurray
Copy link
Contributor

Adding keybindings to new versions of existing extensions brings the risk that some current users will experience problems because the combo we choose clashes with another extension or a keybinding they set up.

I'd be inclined not to set one.

@isc-bsaviano
Copy link
Contributor Author

I'm fine with not setting one

@isc-bsaviano
Copy link
Contributor Author

If you're both happy with this I'll merge it

@gjsjohnmurray
Copy link
Contributor

I shan't have time to review / try this before tomorrow, so go ahead if you want.

@isc-bsaviano
Copy link
Contributor Author

No problem John, I'll wait for you review

@gjsjohnmurray
Copy link
Contributor

How about adding the command to the Explorer view title menu, perhaps with go-to-file as its icon?

@gjsjohnmurray
Copy link
Contributor

Mapped .inc documents are not being hidden. To reproduce this, be connected to a namespace such as USER, set toggles to show system documents and to hide mapped ones. Observe that some %-packages still get listed. Drill into one and discover that you are being offered .inc documents despite them being mapped here from another database.

@gjsjohnmurray
Copy link
Contributor

It would be nice if the three toggle buttons remembered their state between invocations of the selector, at least for the duration of my session, and perhaps persist per workspace.

It would also be nice if I could see the state of each. AFAIK the only way of doing this at the moment might be to create 6 of our own icons, 3 to represent "on" and 3 "off", then manipulate the buttons array. Perhaps the "on" icons would have a solid outline.

Alternatively I could have a go at a PR for microsoft/vscode#185356, or better still my suggestion at microsoft/vscode#221397 (comment) gets accepted.

@isc-bsaviano
Copy link
Contributor Author

How about adding the command to the Explorer view title menu, perhaps with go-to-file as its icon?

You mean the default File Explorer, right? I will see if I can add the command there.

Mapped .inc documents are not being hidden. To reproduce this, be connected to a namespace such as USER, set toggles to show system documents and to hide mapped ones. Observe that some %-packages still get listed. Drill into one and discover that you are being offered .inc documents despite them being mapped here from another database.

This sounds like a bug in the %Library.RoutineMgr_StudioOpenDialog() query. Please report it to the WRC.

It would be nice if the three toggle buttons remembered their state between invocations of the selector, at least for the duration of my session, and perhaps persist per workspace.

It would also be nice if I could see the state of each. AFAIK the only way of doing this at the moment might be to create 6 of our own icons, 3 to represent "on" and 3 "off", then manipulate the buttons array. Perhaps the "on" icons would have a solid outline.

Alternatively I could have a go at a PR for microsoft/vscode#185356, or better still my suggestion at microsoft/vscode#221397 (comment) gets accepted.

I completely agree; this is why I opened that issue a while ago. I think your suggestion or the colored buttons would both be good solutions to this problem.

@gjsjohnmurray
Copy link
Contributor

You mean the default File Explorer, right? I will see if I can add the command there.

Yes.

Another bit of feedback:

image

Could the title be reworded "Open a document in ..."?

@isc-bsaviano
Copy link
Contributor Author

@gjsjohnmurray I have that clumsy language to allow for the API caller to change the suffix but since we have no other callers now I can change that

@isc-bsaviano
Copy link
Contributor Author

@gjsjohnmurray I wasn't able to add the command inline using an icon, but it does appear in the ... menu next to the other icons.

@gjsjohnmurray
Copy link
Contributor

Did you try adding "group": "navigation" to the new entry?

@isc-bsaviano
Copy link
Contributor Author

That worked! I tried "group": "inline" originally, which didn't work.

@gjsjohnmurray
Copy link
Contributor

This sounds like a bug in the %Library.RoutineMgr_StudioOpenDialog() query. Please report it to the WRC.

Logged in WRC as 989244

@gjsjohnmurray
Copy link
Contributor

On a multiroot isfs workspace could the "Select workspace folder" selector default to the folder of the current active document rather thann the first folder?

@isc-bsaviano
Copy link
Contributor Author

The showWorkspaceFolderPick() doesn't allow you to set a default value. I suppose we could create a custom QuickPick with the default set, but that seems a little overkill to me.

@gjsjohnmurray
Copy link
Contributor

I suppose we could create a custom QuickPick

I agree it's not worth the effort of doing that.

@isc-bsaviano
Copy link
Contributor Author

Thanks for all the feedback. I think this is ready to go. If/when we get toggle buttons or colored buttons for QuickPick I will add that to all places in ur extension that would benefit, including this command.

@gjsjohnmurray
Copy link
Contributor

Logged in WRC as 989244

Confirmed by WRC, and Jira DP-433169 opened.

Copy link
Contributor

@gjsjohnmurray gjsjohnmurray left a comment

Choose a reason for hiding this comment

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

Great new feature!

@isc-bsaviano isc-bsaviano merged commit c426c7a into intersystems-community:master Jul 12, 2024
5 checks passed
@isc-bsaviano isc-bsaviano deleted the fix-1379 branch July 12, 2024 14:50
@gjsjohnmurray
Copy link
Contributor

Logged in WRC as 989244

Confirmed by WRC, and Jira DP-433169 opened.

Fixed by MAK5922 (Do not display routines from IRISLIB/IRISSYS when 'mapped=0' parameter for StudioOpenDialog query) which may appear in 2024.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server-Side editing Open items as in Studio
3 participants