Sequence Adaptation
The sequence editor supports uploading a custom sequence adaptation through the Dictionaries page. This custom adaptation can overwrite various features inside of the editor including linting and autocomplete.
The adaptation type is defined in Sequencing and Extension Points
export interface ISequenceAdaptation {
argDelegator?: ArgDelegator;
autoComplete: (
channelDictionary: AmpcsChannelDictionary | null,
commandDictionary: AmpcsCommandDictionary | null,
parameterDictionaries: AmpcsParameterDictionary[],
librarySequences: LibrarySequence[],
) => (context: CompletionContext) => CompletionResult | null;
autoIndent?: () => (context: IndentContext, pos: number) => number | null | undefined;
globals?: GlobalType[];
inputFormat: {
linter?: (
diagnostics: Diagnostic[],
commandDictionary: AmpcsCommandDictionary,
view: EditorView,
node: SyntaxNode,
) => Diagnostic[];
name: string;
toInputFormat?(input: string): Promise<string>;
};
modifyOutput?: (
output: string,
parameterDictionaries: AmpcsParameterDictionary[],
channelDictionary: AmpcsChannelDictionary | null,
) => any;
modifyOutputParse?: (
output: string,
parameterDictionaries: AmpcsParameterDictionary[],
channelDictionary: AmpcsChannelDictionary | null,
) => any;
outputFormat: IOutputFormat[];
}
export type ArgDelegator = {
[stem: string]: {
[arg: string]:
| undefined
| ((
argDef: FswCommandArgument,
paramDictionaries: ParameterDictionary[],
channelDictionary: ChannelDictionary | null,
precedingArgValues: string[],
) => FswCommandArgument | undefined);
};
};
- argDelegator - adaptations may define a function which changes an argument definition from what is in the command dictionary. One use case for this is when the allowed values for an argument are dependent on the context of the surrounding arguments
- autoComplete - adaptations may defined a function which changes the suggestion completions by the editor
- autoIndent - A function to provide an algorithm to use for aligning code and performing indentation
- globals - A collection of values that will be put into scope for syntax checking
- inputFormat - the language that the user will use to author sequences
- modifyOutput - function to transform output file prior to storage
- modifyOutputParse - function to transform an existinng output for purposes of loading into the editor
- outputFormat - an array of languages to transpile the sequence into upon save.