MCPcopy
hub / github.com/microsoft/vscode-js-debug / evaluate

Method evaluate

src/test/test.ts:172–191  ·  view source on GitHub ↗
(expression: string, sourceUrl?: string)

Source from the content-addressed store, hash-verified

170 }
171
172 async evaluate(expression: string, sourceUrl?: string): Promise<Cdp.Runtime.EvaluateResult> {
173 ++this._evaluateCounter;
174 this.log(`Evaluating#${this._evaluateCounter}: ${expression}`);
175 if (sourceUrl === undefined) sourceUrl = `//# sourceURL=eval${this._evaluateCounter}.js`;
176 else if (sourceUrl) sourceUrl = `//# sourceURL=${this.completeUrl(sourceUrl)}`;
177 return this._cdp!.Runtime.evaluate({ expression: expression + `\n${sourceUrl}` }).then(
178 result => {
179 if (!result) {
180 this.log(expression, 'Error evaluating');
181 debugger;
182 throw new Error('Error evaluating "' + expression + '"');
183 } else if (result.exceptionDetails) {
184 this.log(result.exceptionDetails, 'Error evaluating');
185 debugger;
186 throw new Error('Error evaluating "' + expression + '"');
187 }
188 return result;
189 },
190 );
191 }
192
193 async addScriptTag(relativePath: string): Promise<void> {
194 await this._cdp!.Runtime.evaluate({

Callers

nothing calls this directly

Calls 3

completeUrlMethod · 0.95
logMethod · 0.65
evaluateMethod · 0.65

Tested by

no test coverage detected