Skip to content

fix: Create new packages or classes does not work via hotkeys - #467

Merged
Sheng Chen (jdneo) merged 4 commits into
masterfrom
cs/issue-465
Mar 9, 2021
Merged

fix: Create new packages or classes does not work via hotkeys#467
Sheng Chen (jdneo) merged 4 commits into
masterfrom
cs/issue-465

Conversation

@jdneo

Copy link
Copy Markdown
Member

This PR fix #465, including following changes

  • When the commands new package/class are triggered and the parameter is not provided (triggered via hotkeys), get the current selected node.
  • Since the selected node may not a valid node to create package/class, some condition checks are added.
  • In addition, when creating class from a Primary Type, use its declared package as the base path.


export async function newPackage(node: DataNode): Promise<void> {
if (!node.uri) {
if (!node?.uri || !canCreatePackage(node)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one concern. If no node is selected, by triggering keyboard shortcut, nothing would happen. Is that true? If so, "Creating new packages or classes doesn't work using hotkeys" is still true in such scenarios.

I think it would be better to let users know what to do next.

  • Better experience: Prompt to select target package
  • Easy implementation: notification with instructions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. Let me think how to improve this

@Eskibear Yan Zhang (Eskibear) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@jdneo
Sheng Chen (jdneo) merged commit 292ee9f into master Mar 9, 2021
@jdneo
Sheng Chen (jdneo) deleted the cs/issue-465 branch March 9, 2021 09:13
@CsCherrYY Shi Chen (CsCherrYY) added bug Something isn't working and removed bug Something isn't working labels Mar 22, 2021
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.

Creating new packages or classes doesn't work using hotkeys

3 participants