Cache for JSON Schema in VS Code

After updating to TypeScript 1.5 (now out of beta), I am eager to utilize the json schema helpers in VS Code.

Upon configuring tsconfig.json, I noticed that only commonjs and amd module options are available, while umd and system are missing based on this resource:

I'm wondering how I can prompt VS Code to update its schema cache?

Just a heads up, I've already attempted to override the URL in settings and revert it back, as well as restarting VS Code.

Answer №1

  1. After searching extensively, I was unable to locate the official solution for clearing such cache issues. However, it seems like using the "Reload Window" command might do the trick.
  2. The issue of changes not being reflected in the schema file has been identified as a bug and has already been fixed. You can find more information about it here. It's worth noting that the schema file must end with ".json" for the changes to take effect immediately. Using any other extension name, even if specifically associated with json in settings, will not trigger the necessary refresh event.

Answer №2

Seeking guidance on how to update VS Code's schema cache?

The schema is hardcoded within a minified file named jsonWorker.js (located at

C:\Users\basaratsyed\AppData\Local\Code\app-0.1.2\resources\app\client\vs\languages\json\jsonWorker.js
). Here is the beautified code using atom-beautify:

this.addPreloadedFileSchema("http://json.schemastore.org/tsconfig", {
            title: n.localize("vs_languages_json_jsonSchemaService", 110),
            $schema: "http://json-schema.org/draft-04/schema#",
            type: "object",
            default: {
                compilerOptions: {
                    target: "ES5",
                    module: "commonjs"
                }
            },
            properties: {
                compilerOptions: {
                    type: "object",
                    description: n.localize("vs_languages_json_jsonSchemaService", 111),
                    properties: {
                        charset: {
                            description: n.localize("vs_languages_json_jsonSchemaService", 112),
                            type: "string"
                        },
                        // more properties here
                    }
                },
                files: {
                    type: "array",
                    description: n.localize("vs_languages_json_jsonSchemaService", 137),
                    items: {
                        type: "string",
                        format: "uri"
                    }
                }
            }
        })

In particular:

module: {
    description: n.localize("vs_languages_json_jsonSchemaService", 121),
    enum: ["commonjs", "amd"]
},

If you modify it to include additional options like:

module: {
    description: n.localize("vs_languages_json_jsonSchemaService", 121),
    enum: ["commonjs", "amd", "umd", "system"]
},

And then restart VS Code, the changes take effect.

Image reference: https://i.sstatic.net/Q1Q8g.png

Note that despite beautifying the js file, VS Code continues to function properly ;)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error: The value of the expression has been altered after it was already checked. Initial value was 'undefined'. An exception has occurred

Although this question has been asked multiple times, I have read similar issues and still struggle to organize my code to resolve this particular exception. Within my component, there is a property that dynamically changes based on a condition: public e ...

Retrieving the unprocessed data from a Stripe webhook in Nest.js

I'm currently working on integrating a Stripe webhook request into my Nest.js application, and I need to access the raw body of the request. After referencing this example, I incorporated the following code snippet into the module containing a contro ...

I am facing an issue with my Angular 11 CLI application while trying to set it up with Jest. The specific error message I am encountering is: "TypeError: Cannot read property

Having issues with my Angular 11 cli app and Jest integration. Whenever I run npm run test, specifically jest --updateSnapshot, I encounter the following error in my terminal: Error: TypeError: Cannot read property 'paths' of undefined Here is ...

Using NgModel with a custom element

I am currently using a basic component within my form as shown below: <app-slider [min]="field.min" [max]="field.max" [value]="field.min"></app-slider> This component consists of the following code: HTML: <input #mySlider class="s ...

How can I adjust the column width in OfficeGen?

Currently, I am utilizing officeGen for the purpose of generating word documents. <sup> let table = [ [ { val: "TT", fontFamily: "Times New Roman", }, { val: "Ten hang", ...

Count the number of checked checkboxes by looping through ngFor in Angular

My ngFor loop generates a series of checkboxes based on the X number of items in childrenList: <div *ngFor="let child of childrenList; let indice=index"> <p-checkbox label="{{child.firstname}} {{child.lastname}}" binary=&qu ...

What is the best way to dynamically insert values into a JSON object?

I'm currently working with a JSON object in Angular and I need to dynamically add values that the user enters. Despite searching extensively, I haven't found a straightforward method to achieve this. I simply want to understand how to append key- ...

Dealing with multiple queryParams in Angular2: Best practices

Need help implementing a filtering mechanism in my new Angular2 app. Looking to filter a list of entries in an array based on around 20 properties. I've set up filters in one component and a list component as a child that is routed to. Initially, pas ...

In React Router v6, you can now include a custom parameter in createBrowserRouter

Hey there! I'm currently diving into react router v6 and struggling to add custom params in the route object. Unfortunately, I haven't been able to find any examples of how to do it. const AdminRoutes: FunctionComponent = () => { const ...

Starting object arrays in Angular 6 using ES6

As someone who is just starting out with javascript, I have encountered a challenge with a nested class structure. Specifically, I am looking to initialize an array of EventDate objects and assign it to 'this.dates' within the CustomerEvents cons ...

Mastering the art of effectively capturing and incorporating error data

Is there a way to retain and add information to an Error object in typescript/javascript without losing the existing details? Currently, I handle it like this: try { // code that may throw an error } catch (e) { throw new Error(`Error while process ...

Encountering an issue with compiling Angular due to a Type Inference error

interface Course { name: string; lessonCount: number; } interface Named { name: string; } let named: Named = { name: 'Placeholder Name' }; let course: Course = { name: 'Developing Apps with Angular', lessonCount: 15 }; named = ...

Encountered an issue during the transition from Angular 7 to Angular 9

After following the advice in the second response of this discussion, I successfully upgraded to Angular 9. However, I am now encountering an issue in the browser console when running my project. https://i.sstatic.net/esAXf.png Package.json "dependencie ...

Enabling CORS header 'Access-Control-Allow-Origin' in Angular 2 using Typescript

I am currently developing an Angular 2 typescript application on my localhost. I recently encountered an issue when trying to access an external REST API in my application, resulting in the following error message: Cross-Origin Request Blocked: The Same ...

I am facing an issue with Nestjs where it is unable to resolve my dependency, despite the fact that it is readily available within the

Encountering the following error: Error: Nest is unable to resolve dependencies of the CreateGroupTask (TaskQueueService, GroupsService, ?, GroupNotificationsService, GroupRepository, Logger). Please ensure that the argument dependency at index [2] is avai ...

What could be causing my Angular project to not run properly without any changes made after creating a new component that I want to include in app.component.html?

Greetings, I am just starting out with Angular 17 and I am currently going through the Tour of Heroes course on the official website. Following the tutorial's instructions, I created a new component called 'heroes' after setting up my projec ...

Transform the `PascalCase` format into `strictCamelCase` in TypeScript type conversion

By utilizing the built-in Uncapitalize<S> function, you can easily convert a string like FooBar to fooBar: const fooBar: Uncapitalize<'FooBar'> = 'fooBar'; However, this method proves inadequate when dealing with class name ...

What are the ways to enable VS Code's Intellisense to collaborate with AngularJS's injected services?

Hey, I've been trying to get Visual Studio Code to provide me with its intellisense for my unique framework (not Angular) app's services. Although I managed to get the standard type for such frameworks, I'm struggling to find a solution for ...

DiscordJS bot using Typescript experiences audio playback issues that halt after a short period of time

I am currently experiencing difficulties with playing audio through a discord bot that I created. The bot is designed to download a song from YouTube using ytdl-core and then play it, but for some reason, the song stops after a few seconds of playing. Bel ...

Dynamic property access using optional chaining in JavaScript

My attempt to utilize optional chaining, a feature provided by TypeScript for safely accessing dynamic properties, seems to be invalid. export const theme = { headers: { h1: { }, h6: { color: '#828286' }, }, } console.in ...