-
Notifications
You must be signed in to change notification settings - Fork 4.2k
adding draft of detailed spec #57346
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
adding draft of detailed spec #57346
Conversation
|
|
||
| - We should change the commit behavior of these new snippets to only require a single tab to complete | ||
| - If the user types `Tab ↹` twice (due to muscle memory) we will eat the second key press (similar to how automatic brace matching works) | ||
| - Two undo stacks will be created for each snippet that is commited (`Console.WriteLine()` -> `cw` -> ``) |
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.
We should make sure this is consistent with IntelliCode Inline Completion. At least validate that theirs also requires at least 2 undo stacks.
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.
I will leave that to you @mikadumont
|
|
||
| |Name |Descriptive Text in Completion List | Valid synonyms | | ||
| |-----|------------|----------------------------------| | ||
| |`#if` | Create a #if directive and a #endif directive. | directive, pound, hashtag, #if |
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.
We should make sure generate and add are also captured in this list
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.
I am not married to this wording. My only argument in its favor is that is is similar to the docs descriptions here.
| - We may do this someday but for now we want to ensure that we can meet customers’ needs for the narrow case | ||
| - We are not changing the VB experience for snippets (yet) | ||
| - VB has a very different design than C#. | ||
| - We are not changing "Surround With" behavior |
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.
Are we sure we dont want to handle snippets that handles surround with behavior? This needs an update as well.
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.
"Surround With" could be its own spec so I left it out for now :)
I think we have enough work here already that we should re-visit "Surround With" separate from this.
We can still discuss it though to make sure we are on the right page. My assumption is that we would not mess with the VS platforms surround with but instead offer a post-statement option.
So if the user types this if at the end of a statement (after a ; essentially)
FileStream stream = File.OpenRead(@"C:\Users\Public\TestFolder\WriteText.txt");
StreamReader streamReader = new(stream);
string text = streamReader.ReadToEnd();[|if|] // Offered 'surround with if block'They are offered to surround the current line with one of the block snippets.
FileStream stream = File.OpenRead(@"C:\Users\Public\TestFolder\WriteText.txt");
StreamReader streamReader = new(stream);
if (true) // User is put in a special UI mode (!?) where they can choose to expand the selection
{
string text = streamReader.ReadToEnd();
}We would then need to offer some custom UI in the editor to allow the user to select what statements should be included in the block.
We may also want a short/dedicated snippet for placing everything in the current block in the new block so if the developer types this:
void M()
{
FileStream stream = File.OpenRead(@"C:\Users\Public\TestFolder\WriteText.txt");
StreamReader streamReader = new(stream);
string text = streamReader.ReadToEnd();|try|] // Offered 'surround with try/catch statement'
// and 'surround all with try/catch statement'
}If the developer chooses 'surround all with try/catch statement' then they get:
void M()
{
try
{
FileStream stream = File.OpenRead(@"C:\Users\Public\TestFolder\WriteText.txt");
StreamReader streamReader = new(stream);
string text = streamReader.ReadToEnd();
}
catch (Exception)
{
throw;
}
}Unanswered questions with this design:
- How does the user dynamically expand the set of things they want to include in the block?
- Should these only be offered at the end of semicolons (
;) or are there expression contexts where these should offered?
|
@CyrusNajmabadi I believe you missed the design meeting where we discussed this but I would appreciate your opinion here |
@akhera99 and @mikadumont here is a draft of the formal spec. Please call out sections that aren't clear :)
releated to #56541