From af59982f5ed84d6af82f5827a50e2955373cc53f Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sun, 18 Aug 2024 11:47:02 +0200 Subject: [PATCH] Allow spaces and periods in instance names --- CHANGELOG.md | 6 ++++++ editors/vscode/src/providers/insertInstance/index.ts | 4 ++-- editors/vscode/src/providers/renameInstance/index.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e80cf..687ff2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fixed spaces and periods in instance names not being allowed for insert & rename operations. + ## `0.3.3` - July 24th, 2024 ### Added diff --git a/editors/vscode/src/providers/insertInstance/index.ts b/editors/vscode/src/providers/insertInstance/index.ts index bb48e45..0de8f09 100644 --- a/editors/vscode/src/providers/insertInstance/index.ts +++ b/editors/vscode/src/providers/insertInstance/index.ts @@ -96,7 +96,7 @@ export class InsertInstanceProvider implements vscode.Disposable { if (this.currentWorkspacePath && this.currentInstance) { if (hasDisallowedCharacter(this.input.value)) { this.input.validationMessage = - "Name must only contain alphanumeric characters, underscores, and dashes" + 'Name must only contain alphanumeric characters, or one of the following characters: ".", "_", "-", " "' } else { this.input.validationMessage = undefined } @@ -226,5 +226,5 @@ export class InsertInstanceProvider implements vscode.Disposable { } const hasDisallowedCharacter = (s: string): boolean => { - return /[^a-zA-Z0-9_-]/.test(s) + return /[^a-zA-Z0-9_. -]/.test(s) } diff --git a/editors/vscode/src/providers/renameInstance/index.ts b/editors/vscode/src/providers/renameInstance/index.ts index d2d1ac2..a0efb7d 100644 --- a/editors/vscode/src/providers/renameInstance/index.ts +++ b/editors/vscode/src/providers/renameInstance/index.ts @@ -35,7 +35,7 @@ export class RenameInstanceProvider implements vscode.Disposable { if (this.currentWorkspacePath && this.currentInstance) { if (hasDisallowedCharacter(this.input.value)) { this.input.validationMessage = - "Name must only contain alphanumeric characters, underscores, and dashes" + 'Name must only contain alphanumeric characters, or one of the following characters: ".", "_", "-", " "' } else { this.input.validationMessage = undefined } @@ -86,5 +86,5 @@ export class RenameInstanceProvider implements vscode.Disposable { } const hasDisallowedCharacter = (s: string): boolean => { - return /[^a-zA-Z0-9_-]/.test(s) + return /[^a-zA-Z0-9_. -]/.test(s) }