Why this regex doesn't work in vscode but works in another site?

Advertisements I don’t know much about regex, but I’m trying to use this regex made by chatGPT in vscode but it returns nothing as result. But when I try to use in another site like https://regex101.com/, the string matches. Regex: throw\s+new\s+ApiResponseError\s*\(\s*HttpStatusCode\.([^,]+),\s*(‘[^’]*’|"[^"]*"),\s*new\s+Error\(`([^`]*)`\),\s*(true|false)?\s*\) Pattern that matches in the site: throw new ApiResponseError( HttpStatusCode.BAD_REQUEST, ‘low’, new Error(`Required parameters… Read More Why this regex doesn't work in vscode but works in another site?

How can I make a VS Code reference from one class to another class file while it is injected through a constructor?

Advertisements I have three files: index.js employee.js employer.js index.js import Employer from "./employer.js" import Employee from "./employee.js" const employer = new Employer(); const employee = new Employee(employer); employee.js class Employee { constructor(employer) { this.employer = employer; } getEmployer() { return this.employer.name(); } } employer.js class Employer() { name() { return "Default Employer"; } } The… Read More How can I make a VS Code reference from one class to another class file while it is injected through a constructor?

How can I make an arrow function show up in the functions section of the Outline search instead of the variables section?

Advertisements The VS Code code navigation is not working with arrow functions defined: async function all(req: Request, res: Response) { ….. const checkLogin = async (req: Request, res: Response) => { When I display the code navigation, this is what I see: I would like to have the checkLogin definition in the functions section. Is… Read More How can I make an arrow function show up in the functions section of the Outline search instead of the variables section?

Why does VS Code show different autocompletions (trigger suggest) when manually triggering?

Advertisements Whenever I start writing code like this and I put there quotation marks the autocomplete works fine: However, when I close it and then manually trigger the autocomplete to show up again I end up with this: The autocomplete list still contains the correct values but there’s like a hundred snippets before. Some of… Read More Why does VS Code show different autocompletions (trigger suggest) when manually triggering?

Why does VS Code colour JavaScript's `Math` and `Number` differently?

Advertisements Take Math.random and Number.MAX_VALUE function. Why is Number green and the other Blue (for my colour theme). This also applies to static methods on Number. >Solution : If you inspect the token scopes using Developer: Inspect Editor Tokens and Scopes, you’ll see: For Math: "semantic token type: variable" For Number: "semantic token type: class"… Read More Why does VS Code colour JavaScript's `Math` and `Number` differently?

What setting in VSCode makes the editor stop rearranging curly brackets?

Advertisements VSCode is a great IDE, but sometimes it doesn’t do what I want. On saving my file, the editor changes the position of my curly brackets. (I am editing mainly PHP and JS, and VSCode version 1.77.1, with only 1 extension: Intelephense) for example: function glue($a, $b){ return $a . $b; } changes into:… Read More What setting in VSCode makes the editor stop rearranging curly brackets?