Skip to content
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

Semantic snippets: don't provide snippets when dotting of a type name #74841

Merged
merged 5 commits into from
Aug 23, 2024

Conversation

DoctorKrolic
Copy link
Contributor

@DoctorKrolic DoctorKrolic requested a review from a team as a code owner August 21, 2024 18:46
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 21, 2024
@dotnet-policy-service dotnet-policy-service bot added Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode labels Aug 21, 2024
@DoctorKrolic
Copy link
Contributor Author

@akhera99 PTAL on this simple fix

@MartyIX
Copy link
Contributor

MartyIX commented Aug 22, 2024

Is there any documentation for semantic snippets that would explain how the feature work? Thanks!

@DoctorKrolic
Copy link
Contributor Author

@MartyIX I don't think we have a centralized place where all capabilities of semantic snippets are described. Maybe take a look at the original proposal, but it has quite a few outdated/not yet implemented details. But in short I can describe semantic snippets thre following way:

  • They appear in completion list only where they are actually valid (e.g. you won't get class snippet inside a method)
  • They try to avoid compiler errors when inserted (e.g. class snippet by default creates MyClass type, bu if there is already such name in the scope, snippet will generate MyClass1 to avoid naming conflict)
  • They respect your code style settings (e.g. if you have 'Require accessibility modifiers' setting set to 'always' then class snippet will generate public class MyClass instead of just class MyClass)
  • They have additional advanced features that aren't available for legacy snippets. For instance, we have what we reffer to as "inline statement snippets". These can be inserted if you type them after . as a member access, which is very useful (I myself use this thing a lot). An example here is:
    devenv_HMOWDZkxfA

@MartyIX
Copy link
Contributor

MartyIX commented Aug 22, 2024

That's a great description. Thank you!

Copy link
Member

@akhera99 akhera99 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@akhera99 akhera99 enabled auto-merge (squash) August 22, 2024 16:34
@DoctorKrolic
Copy link
Contributor Author

@CyrusNajmabadi PTAL

@CyrusNajmabadi
Copy link
Member

looks good. thanks!

@CyrusNajmabadi CyrusNajmabadi merged commit b360f99 into dotnet:main Aug 23, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 23, 2024
@DoctorKrolic DoctorKrolic deleted the no-snippets-on-types branch August 24, 2024 06:53
@dibarbet dibarbet modified the milestones: Next, 17.12 P2 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants