-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4494: Support snippet text edit r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
- Loading branch information
Showing
31 changed files
with
552 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Settings for tweaking assists. | ||
//! | ||
//! The fun thing here is `SnippetCap` -- this type can only be created in this | ||
//! module, and we use to statically check that we only produce snippet | ||
//! assists if we are allowed to. | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct AssistConfig { | ||
pub snippet_cap: Option<SnippetCap>, | ||
} | ||
|
||
impl AssistConfig { | ||
pub fn allow_snippets(&mut self, yes: bool) { | ||
self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None } | ||
} | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
pub struct SnippetCap { | ||
_private: (), | ||
} | ||
|
||
impl Default for AssistConfig { | ||
fn default() -> Self { | ||
AssistConfig { snippet_cap: Some(SnippetCap { _private: () }) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.