Skip to content

Commit

Permalink
Merge pull request #277 from marp-team/auto-trigger-directive-value-c…
Browse files Browse the repository at this point in the history
…ompletion

Auto-trigger suggestion for value of supported directives
  • Loading branch information
yhatt authored Aug 21, 2021
2 parents cac9dc8 + 5065036 commit 9a43048
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Auto completion for [`size` global directive](https://github.com/marp-team/marp-core#size-global-directive) ([#276](https://github.com/marp-team/marp-vscode/pull/276))
- `unknown-size` diagnostic: Notify if the specified size preset was not defined in a theme ([#276](https://github.com/marp-team/marp-vscode/pull/276))
- Auto-trigger suggestion for value of supported directives ([#277](https://github.com/marp-team/marp-vscode/pull/277))

### Changed

Expand Down
5 changes: 5 additions & 0 deletions src/directives/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export enum DirectiveProvidedBy {

interface DirectiveInfoBase {
allowed: readonly DirectiveDefinedIn[]
completable?: boolean
description: string
details?: string
markdownDescription: MarkdownString
Expand Down Expand Up @@ -94,6 +95,7 @@ export const builtinDirectives = [
providedBy: DirectiveProvidedBy.Marpit,
type: DirectiveType.Global,
details: 'https://marpit.marp.app/directives?id=theme',
completable: true,
}),
createDirectiveInfo({
name: 'style',
Expand Down Expand Up @@ -146,6 +148,7 @@ export const builtinDirectives = [
providedBy: DirectiveProvidedBy.Marpit,
type: DirectiveType.Local,
details: 'https://marpit.marp.app/directives?id=pagination',
completable: true,
}),
createDirectiveInfo({
name: 'header',
Expand Down Expand Up @@ -270,6 +273,7 @@ export const builtinDirectives = [
providedBy: DirectiveProvidedBy.MarpCore,
type: DirectiveType.Global,
details: 'https://github.com/marp-team/marp-core#math-global-directive',
completable: true,
}),
createDirectiveInfo({
name: 'size',
Expand All @@ -282,6 +286,7 @@ export const builtinDirectives = [
providedBy: DirectiveProvidedBy.MarpCore,
type: DirectiveType.Global,
details: 'https://github.com/marp-team/marp-core#size-global-directive',
completable: true,
}),

// Marp CLI metadata options
Expand Down
6 changes: 6 additions & 0 deletions src/language/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ class CompletionProvider {
kind: CompletionItemKind.Property,
label: d.name,
range,
command: d.completable
? {
command: 'editor.action.triggerSuggest',
title: 'Trigger suggest',
}
: undefined,
})
)
)
Expand Down

0 comments on commit 9a43048

Please sign in to comment.