mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 09:51:10 +01:00
Fix pairs language not highlighting
This commit is contained in:
@@ -105,6 +105,7 @@ export function getLanguageExtension({
|
||||
return graphql();
|
||||
}
|
||||
|
||||
console.log("SELECTING SYNTAX", language);
|
||||
const base = syntaxExtensions[language ?? 'text'] ?? text();
|
||||
if (!useTemplating) {
|
||||
return base;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
||||
import { parser } from './pairs';
|
||||
|
||||
const urlLanguage = LRLanguage.define({
|
||||
const language = LRLanguage.define({
|
||||
name: 'pairs',
|
||||
parser,
|
||||
languageData: {},
|
||||
});
|
||||
|
||||
export function pairs() {
|
||||
return new LanguageSupport(urlLanguage, []);
|
||||
return new LanguageSupport(language, []);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
||||
import { parser } from './text';
|
||||
|
||||
export const textLanguageName = 'text';
|
||||
|
||||
const textLanguage = LRLanguage.define({
|
||||
name: textLanguageName,
|
||||
export const textLanguage = LRLanguage.define({
|
||||
name: 'text',
|
||||
parser,
|
||||
languageData: {},
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ import { parseMixed } from '@lezer/common';
|
||||
import type { EnvironmentVariable } from '@yaakapp-internal/models';
|
||||
import type { GenericCompletionConfig } from '../genericCompletion';
|
||||
import { genericCompletion } from '../genericCompletion';
|
||||
import { textLanguageName } from '../text/extension';
|
||||
import { textLanguage } from '../text/extension';
|
||||
import type { TwigCompletionOption } from './completion';
|
||||
import { twigCompletion } from './completion';
|
||||
import { templateTagsPlugin } from './templateTags';
|
||||
@@ -63,12 +63,10 @@ function mixLanguage(base: LanguageSupport): LRLanguage {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const name = 'twig';
|
||||
|
||||
const parser = twigParser.configure({
|
||||
wrap: parseMixed((node) => {
|
||||
// If the base language is text, we can overwrite at the top
|
||||
if (base.language.name !== textLanguageName && !node.type.isTop) {
|
||||
if (base.language.name !== textLanguage.name && !node.type.isTop) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -79,7 +77,7 @@ function mixLanguage(base: LanguageSupport): LRLanguage {
|
||||
}),
|
||||
});
|
||||
|
||||
const language = LRLanguage.define({ name, parser });
|
||||
const language = LRLanguage.define({ name: 'twig', parser });
|
||||
mixedLanguagesCache[base.language.name] = language;
|
||||
return language;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
||||
import { parser } from './url';
|
||||
|
||||
const urlLanguage = LRLanguage.define({
|
||||
name: 'url',
|
||||
parser,
|
||||
languageData: {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user