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

joh/familiar sparrow #155613

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rename to isFileTemplate
  • Loading branch information
jrieken committed Jul 19, 2022
commit 98ee0a7b57e2ee4b559ea5220e124bd386a256bf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class SelectSnippetForEmptyFile extends SnippetsAction {
return;
}

const snippets = await snippetService.getSnippets(undefined, { topLevelSnippets: true, noRecencySort: true, includeNoPrefixSnippets: true });
const snippets = await snippetService.getSnippets(undefined, { fileTemplateSnippets: true, noRecencySort: true, includeNoPrefixSnippets: true });
if (snippets.length === 0) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const snippetSchemaProperties: IJSONSchemaMap = {
description: nls.localize('snippetSchema.json.prefix', 'The prefix to use when selecting the snippet in intellisense'),
type: ['string', 'array']
},
isTopLevel: {
description: nls.localize('snippetSchema.json.isTopLevel', 'The snippet is only applicable to empty files.'),
isFileTemplate: {
description: nls.localize('snippetSchema.json.isFileTemplate', 'The snippet is meant to populate or replace a whole file'),
type: 'boolean'
},
body: {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/snippets/browser/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ISnippetGetOptions {
includeDisabledSnippets?: boolean;
includeNoPrefixSnippets?: boolean;
noRecencySort?: boolean;
topLevelSnippets?: boolean;
fileTemplateSnippets?: boolean;
}

export interface ISnippetsService {
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/contrib/snippets/browser/snippetsFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Snippet {
readonly prefixLow: string;

constructor(
readonly isTopLevel: boolean,
readonly isFileTemplate: boolean,
readonly scopes: string[],
readonly name: string,
readonly prefix: string,
Expand Down Expand Up @@ -143,7 +143,7 @@ export class Snippet {


interface JsonSerializedSnippet {
isTopLevel?: boolean;
isFileTemplate?: boolean;
body: string | string[];
scope?: string;
prefix: string | string[] | undefined;
Expand Down Expand Up @@ -261,7 +261,7 @@ export class SnippetFile {

private _parseSnippet(name: string, snippet: JsonSerializedSnippet, bucket: Snippet[]): void {

let { isTopLevel, prefix, body, description } = snippet;
let { isFileTemplate, prefix, body, description } = snippet;

if (!prefix) {
prefix = '';
Expand Down Expand Up @@ -306,7 +306,7 @@ export class SnippetFile {

for (const _prefix of Array.isArray(prefix) ? prefix : Iterable.single(prefix)) {
bucket.push(new Snippet(
Boolean(isTopLevel),
Boolean(isFileTemplate),
scopes,
name,
_prefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class SnippetsService implements ISnippetsService {
// enabled or disabled wanted
continue;
}
if (typeof opts?.topLevelSnippets === 'boolean' && opts.topLevelSnippets !== snippet.isTopLevel) {
if (typeof opts?.fileTemplateSnippets === 'boolean' && opts.fileTemplateSnippets !== snippet.isFileTemplate) {
// isTopLevel requested but mismatching
continue;
}
Expand Down