Skip to content

Commit

Permalink
Merge pull request #446 from marp-team/lang-directive-definition
Browse files Browse the repository at this point in the history
Add IntelliSense definition for `lang` global directive
  • Loading branch information
yhatt authored Oct 28, 2023
2 parents f02b015 + 3784347 commit 75f099c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
- Upgrade Marp CLI to [v3.4.0](https://github.com/marp-team/marp-cli/releases/tag/v3.4.0) ([#444](https://github.com/marp-team/marp-vscode/pull/444))
- Upgrade dependent packages to the latest version ([#445](https://github.com/marp-team/marp-vscode/pull/445))

### Added

- IntelliSense definition for `lang` global directive ([#430](https://github.com/marp-team/marp-vscode/issues/430), [#446](https://github.com/marp-team/marp-vscode/pull/446))

### Fixed

- Disappeared inline elements with `position: relative` that are the direct children of the slide ([#442](https://github.com/marp-team/marp-vscode/issues/442), [#443](https://github.com/marp-team/marp-vscode/pull/443))
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = {
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
coverageThreshold: { global: { lines: 95 } },
preset: 'ts-jest/presets/js-with-babel',
prettierPath: null,
setupFiles: ['<rootDir>/jest.setup.js'],
testEnvironment: 'node',
transformIgnorePatterns: [`/node_modules/(?!${esModules.join('|')})`],
Expand Down
7 changes: 7 additions & 0 deletions src/directives/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export const builtinDirectives = [
details: 'https://marpit.marp.app/directives?id=theme',
completable: true,
}),
createDirectiveInfo({
name: 'lang',
description: 'Set the `lang` attribute of the entire slide deck.',
allowed: directiveAlwaysAllowed,
providedBy: DirectiveProvidedBy.Marpit,
type: DirectiveType.Global,
}),
createDirectiveInfo({
name: 'style',
description: dedent(`
Expand Down
104 changes: 53 additions & 51 deletions src/language/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,32 +112,33 @@ describe('Auto completions', () => {
const labels = list.items.map((item) => item.label).sort()

expect(labels).toMatchInlineSnapshot(`
[
"author",
"backgroundColor",
"backgroundImage",
"backgroundPosition",
"backgroundRepeat",
"backgroundSize",
"class",
"color",
"description",
"footer",
"header",
"headingDivider",
"image",
"keywords",
"marp",
"math",
"paginate",
"size",
"style",
"theme",
"title",
"transition",
"url",
]
`)
[
"author",
"backgroundColor",
"backgroundImage",
"backgroundPosition",
"backgroundRepeat",
"backgroundSize",
"class",
"color",
"description",
"footer",
"header",
"headingDivider",
"image",
"keywords",
"lang",
"marp",
"math",
"paginate",
"size",
"style",
"theme",
"title",
"transition",
"url",
]
`)

// The insert text has semicolon
expect(list.items[0].insertText).toBe(`${list.items[0].label}: `)
Expand All @@ -155,31 +156,32 @@ describe('Auto completions', () => {
const labels = list.items.map((item) => item.label).sort()

expect(labels).toMatchInlineSnapshot(`
[
"author",
"backgroundColor",
"backgroundImage",
"backgroundPosition",
"backgroundRepeat",
"backgroundSize",
"class",
"color",
"description",
"footer",
"header",
"headingDivider",
"image",
"keywords",
"math",
"paginate",
"size",
"style",
"theme",
"title",
"transition",
"url",
]
`)
[
"author",
"backgroundColor",
"backgroundImage",
"backgroundPosition",
"backgroundRepeat",
"backgroundSize",
"class",
"color",
"description",
"footer",
"header",
"headingDivider",
"image",
"keywords",
"lang",
"math",
"paginate",
"size",
"style",
"theme",
"title",
"transition",
"url",
]
`)
expect(labels).not.toContain('marp')
})

Expand Down

0 comments on commit 75f099c

Please sign in to comment.