diff --git a/package.json b/package.json index 1e8339e..f8bf025 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,8 @@ "php.memoryLimit": { "type": "string", "default": "-1", - "description": "The memory limit of the php language server. [Number][K|M|G]. Use '-1' to allow unlimited use of the RAM(default)." + "description": "The memory limit of the php language server. [Number][K|M|G]. Use '-1' to allow unlimited use of the RAM(default).", + "schema": "!/^\d+(?:K|M|G|)$/" } } } diff --git a/src/extension.ts b/src/extension.ts index 8f5f491..6bce406 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -14,7 +14,7 @@ export async function activate(context: vscode.ExtensionContext): Promise const memoryLimit = conf.get('memoryLimit') || '-1'; - if (memoryLimit !== '-1' && !memoryLimit.match('~^(\d+)(K|M|G|)$~')) { + if (memoryLimit !== '-1' && !/^\d+(?:K|M|G|)$/.exec(memoryLimit)) { const selected = await vscode.window.showErrorMessage( 'The memory limit you\'d provided is not numeric, nor "-1" nor valid php shorthand notation!', 'Open settings'