Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/adapter/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export interface ICompletions {
completions(options: ICompletionContext & ICompletionExpression): Promise<Dap.CompletionItem[]>;
}

const validIdentifierRe = /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;

/**
* Provides REPL completions for the debug session.
*/
Expand Down Expand Up @@ -280,9 +282,7 @@ export class Completions {

const start = getStart(node.property) - 1;

// For any properties are aren't valid identifiers, (erring on the side of
// caution--not checking unicode and such), quote them as foo['bar!']
const validIdentifierRe = /^[$a-z_][0-9a-z_$]*$/i;
// For any properties that aren't valid identifiers, quote them as foo['bar!']
for (const item of result) {
if (!validIdentifierRe.test(item.label)) {
item.text = `[${JSON.stringify(item.label)}]`;
Expand Down
4 changes: 2 additions & 2 deletions src/adapter/variableStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const enum SortOrder {

const customStringReprMaxLength = 1024;

const identifierRe = /^[$a-z_][0-9a-z_$]*$/i;
const privatePropertyRe = /^#[0-9a-z_$]+$/i;
const identifierRe = /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;
const privatePropertyRe = /^#[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;

type AnyPropertyDescriptor = Cdp.Runtime.PropertyDescriptor | Cdp.Runtime.PrivatePropertyDescriptor;

Expand Down
3 changes: 1 addition & 2 deletions src/common/sourceMaps/renameScopeAndSourceMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ enum Constant {
SourceMapNameIndex = 4,
}

/** Very approximate regex for JS identifiers */
const identifierRe = /[$a-z_][$0-9A-Z_$]*/iy;
const identifierRe = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/uy;

export const extractScopeRenames = async (source: string, sourceMap: SourceMap) => {
const toOffset = new PositionToOffset(source);
Expand Down
4 changes: 3 additions & 1 deletion src/targets/node/nodeLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ export class NodeLauncher extends NodeLauncherBase<INodeLaunchConfiguration> {
return targetProgram;
}

const resolve = this.vscode ? readConfig(this.vscode.workspace, Configuration.ResolveDebugEntrypoint) : true;
const resolve = this.vscode
? readConfig(this.vscode.workspace, Configuration.ResolveDebugEntrypoint)
: true;
if (!resolve) {
return targetProgram;
}
Expand Down