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

Add IntelliSense definition for lang global directive #446

Merged
merged 4 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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