MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / appendVariable

Method appendVariable

src/test/mocks/vsc/extHostedTypes.ts:905–925  ·  view source on GitHub ↗
(name: string, defaultValue?: string | ((snippet: SnippetString) => any))

Source from the content-addressed store, hash-verified

903 }
904
905 appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString {
906 if (typeof defaultValue === 'function') {
907 const nested = new SnippetString();
908 nested._tabstop = this._tabstop;
909 defaultValue(nested);
910 this._tabstop = nested._tabstop;
911 defaultValue = nested.value;
912 } else if (typeof defaultValue === 'string') {
913 defaultValue = defaultValue.replace(/\$|}/g, '\\$&'); // CodeQL [SM02383] This code is not used in production, only used for mocks in testing.
914 }
915
916 this.value += '${';
917 this.value += name;
918 if (defaultValue) {
919 this.value += ':';
920 this.value += defaultValue;
921 }
922 this.value += '}';
923
924 return this;
925 }
926 }
927
928 export enum DiagnosticTag {

Callers

nothing calls this directly

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected