mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 08:59:22 +01:00
Variables under Environment, and render all props
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
|
||||
/* Bring above on hover */
|
||||
@apply hover:z-10 relative;
|
||||
|
||||
-webkit-text-security: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user