-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add Create Quick Filter
action
#1393
Add Create Quick Filter
action
#1393
Conversation
@liam I decided to go with the |
@SanjulaGanepola We are going to need a matching PR in the docs repo for this functionality too before this can be merged. Thanks! |
Created a PR for the doc updates: codefori/docs#10 |
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.
Good job, it works as expected. I'd suggest a few changes to make the code flow unambiguous.
I also have two comments:
- Is there an actual need to create a filter to list libraries?
- There is a slight possibility that the new filter has the same name as an existing one. It may be better to name it using
newFilter
's content and check if this name is already taken (in which case you could append _1 to it).
src/views/objectBrowser.js
Outdated
if(await vscode.window.showErrorMessage(`Error creating filter ${newFilter}`, `Retry`)){ | ||
vscode.commands.executeCommand(`code-for-ibmi.createQuickFilter`, node, newFilter); | ||
} |
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.
Since the input is validated by the regex, is there any actual way this block could be reached?
If no, remove it and remove both node
and newFilter
as they serve no purpose.
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.
Since we are using validateInput
with the regex already, this block should not be reachable so I removed it. Thanks for catching that
config.objectFilters = objectFilters; | ||
await ConnectionConfiguration.update(config); | ||
this.refresh(); |
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.
Do this only if a new filter has been actually added (i.e. if newFilter
is ok).
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.
This is already contained inside of the if(newFilter)
so I think we know for sure the filter is added.
Signed-off-by: Sanjula Ganepola <[email protected]>
Signed-off-by: Sanjula Ganepola <[email protected]>
Although it may not be very common, I think it is more to support users who may want to browse for a library they would like to modify/delete/etc. Also in Project Explorer, we contribute several inline and right-click menu actions on libraries that include updating the library list, setting variables, or for migrating source to the local project.
The naming logic I used is the same as the default behaviour of the current |
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.
Changes look good, thanks! On second thought, the possibility that a "Filter 3" already exists when it gets created is so slim we won't worry about it for now.
Changes
Add
Create Quick Filter
action that allows users to quickly type a filter of the following format:LIB*
orLIB/OBJ/MBR.MBRTYPE (OBJTYPE)
where each parameter is optional except the library. For parameters which are not provided, the defaults will be used.Checklist
console.log
s I added