Variables under Environment, and render all props

This commit is contained in:
Gregory Schier
2023-10-28 11:29:29 -07:00
parent eb1cd1c14b
commit 15087f2d5a
17 changed files with 263 additions and 275 deletions

View File

@@ -54,6 +54,8 @@
/* Bring above on hover */
@apply hover:z-10 relative;
-webkit-text-security: none;
}
}

View File

@@ -12,7 +12,6 @@ import './Editor.css';
import { baseExtensions, getLanguageExtension, multiLineExtensions } from './extensions';
import type { GenericCompletionConfig } from './genericCompletion';
import { singleLineExt } from './singleLine';
import { useEnvironments } from '../../../hooks/useEnvironments';
import { useActiveEnvironment } from '../../../hooks/useActiveEnvironment';
// Export some things so all the code-split parts are in this file

View File

@@ -48,7 +48,7 @@ const placeholderMatcher = new BetterMatchDecorator({
if (groupMatch == null) {
// Should never happen, but make TS happy
console.warn('Group match was empty', match);
return Decoration.replace({});;
return Decoration.replace({});
}
return Decoration.replace({

View File

@@ -9,11 +9,13 @@ import { twigCompletion } from './completion';
import { parser as twigParser } from './twig';
import type { Environment } from '../../../../lib/models';
export function twig(base: LanguageSupport, environment: Environment | null, autocomplete?: GenericCompletionConfig) {
// TODO: fill variables here
const data = environment?.data ?? {};
const options = Object.keys(data).map(key => ({ name: key }));
const completions = twigCompletion({ options });
export function twig(
base: LanguageSupport,
environment: Environment | null,
autocomplete?: GenericCompletionConfig,
) {
const variables = environment?.variables ?? [];
const completions = twigCompletion({ options: variables });
const language = mixLanguage(base);
const completion = language.data.of({ autocomplete: completions });