Skip to content

Commit

Permalink
Add a multi line tag snippet.
Browse files Browse the repository at this point in the history
This takes priority over a single line tag.

Also get continued indent to work in PGML blocks.
  • Loading branch information
drgrice1 committed Nov 15, 2024
1 parent 1e3095a commit 817796e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openwebwork/codemirror-lang-pg",
"version": "0.0.1-beta.10",
"version": "0.0.1-beta.11",
"description": "PG language support for CodeMirror",
"author": "The WeBWorK Project",
"license": "MIT",
Expand Down
28 changes: 19 additions & 9 deletions src/pgml-language-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { CompletionContext } from '@codemirror/autocomplete';
import { snippetCompletion } from '@codemirror/autocomplete';

export const pgmlIndent = {
PGMLContent: () => null,
PerlCommand: delimitedIndent({ closing: '@]' }),
Table: delimitedIndent({ closing: '#]' }),
Tag: delimitedIndent({ closing: '>]' })
Expand Down Expand Up @@ -155,13 +156,22 @@ const imageSnippet = snippetCompletion('[!${alt text}!]{${$source}}${}', {
boost: i--
});

const tagSnippet = snippetCompletion('[<${ }>]${}', {
label: '[< >]',
info: 'html tag',
type: 'type',
section: { name: 'substitution', rank: ++rank },
boost: i--
});
const tagSnippets = [
snippetCompletion('[<\n\t${ }\n>]${}', {
label: '[< >]',
info: 'html tag (multi line)',
type: 'type',
section: { name: 'substitution', rank: ++rank },
boost: i--
}),
snippetCompletion('[<${ }>]${}', {
label: '[< >]',
info: 'html tag (single line)',
type: 'type',
section: { name: 'substitution', rank },
boost: i--
})
];

const commentSnippet = snippetCompletion('[% ${ } %]${}', {
label: '[% %]',
Expand Down Expand Up @@ -324,7 +334,7 @@ export const pgmlLanguageData = {
...variableSnippets,
...perlCommandSnippets,
imageSnippet,
tagSnippet,
...tagSnippets,
commentSnippet,
...tableSnippets,
...verbatimSnippets
Expand All @@ -350,7 +360,7 @@ export const pgmlLanguageData = {
...variableSnippets,
...perlCommandSnippets,
imageSnippet,
tagSnippet,
...tagSnippets,
commentSnippet,
...tableSnippets,
...verbatimSnippets,
Expand Down

0 comments on commit 817796e

Please sign in to comment.