temporarily disable sample autocomplete
This commit is contained in:
parent
7b92874909
commit
2b575d50b9
1 changed files with 6 additions and 3 deletions
|
|
@ -3,7 +3,8 @@ import { autocompletion } from '@codemirror/autocomplete';
|
||||||
import { h } from './html';
|
import { h } from './html';
|
||||||
//TODO: fix tonal scale import
|
//TODO: fix tonal scale import
|
||||||
// import { Scale } from '@tonaljs/tonal';
|
// import { Scale } from '@tonaljs/tonal';
|
||||||
import { soundMap } from '@strudel/webaudio';
|
// import { soundMap } from '@strudel/webaudio';
|
||||||
|
let soundMap = undefined;
|
||||||
import { complex } from '@strudel/tonal';
|
import { complex } from '@strudel/tonal';
|
||||||
|
|
||||||
const escapeHtml = (str) => {
|
const escapeHtml = (str) => {
|
||||||
|
|
@ -80,7 +81,9 @@ const hasExcludedTags = (doc) =>
|
||||||
['superdirtOnly', 'noAutocomplete'].some((tag) => doc.tags?.find((t) => t.originalTitle === tag));
|
['superdirtOnly', 'noAutocomplete'].some((tag) => doc.tags?.find((t) => t.originalTitle === tag));
|
||||||
|
|
||||||
export function bankCompletions() {
|
export function bankCompletions() {
|
||||||
const soundDict = soundMap.get();
|
// TODO: FIX IMPORT
|
||||||
|
const soundDict = soundMap?.get() ?? {};
|
||||||
|
|
||||||
const banks = new Set();
|
const banks = new Set();
|
||||||
for (const key of Object.keys(soundDict)) {
|
for (const key of Object.keys(soundDict)) {
|
||||||
const [bank, suffix] = key.split('_');
|
const [bank, suffix] = key.split('_');
|
||||||
|
|
@ -269,7 +272,7 @@ function soundHandler(context) {
|
||||||
const inside = text.slice(quoteIdx + 1);
|
const inside = text.slice(quoteIdx + 1);
|
||||||
const fragMatch = inside.match(SOUND_FRAGMENT_MATCH_REGEX);
|
const fragMatch = inside.match(SOUND_FRAGMENT_MATCH_REGEX);
|
||||||
const fragment = fragMatch ? fragMatch[1] : inside;
|
const fragment = fragMatch ? fragMatch[1] : inside;
|
||||||
const soundNames = Object.keys(soundMap.get()).sort();
|
const soundNames = Object.keys(soundMap?.get() ?? {}).sort();
|
||||||
const filteredSounds = soundNames.filter((name) => name.includes(fragment));
|
const filteredSounds = soundNames.filter((name) => name.includes(fragment));
|
||||||
let options = filteredSounds.map((name) => ({ label: name, type: 'sound' }));
|
let options = filteredSounds.map((name) => ({ label: name, type: 'sound' }));
|
||||||
const from = soundContext.to - fragment.length;
|
const from = soundContext.to - fragment.length;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue