How to use the vscode-uri/lib/umd.file function in vscode-uri

To help you get started, we’ve selected a few vscode-uri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
private async resourceScriptAddToInternalModel(scriptName: string, gmlFilePath: string, thisYYFile: Resource.Script) {
        const URIstring = URI.file(gmlFilePath).toString();
        this.reference.addResource(scriptName, 'GMScript');
        this.reference.scriptSetURI(scriptName, URIstring);
        await this.documentCreateDocumentFolder(gmlFilePath, scriptName, 'GMScript');

        this.projectResources[thisYYFile.id] = thisYYFile;

        // Set an empty hash (we save this to just save our time)
        this.reference.URISetHash(URIstring, this.emptySHA1Hash);
    }
github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
public async initProjDocs(dirname: string) {
        // Create the Actual File:
        this.setCachedFileText(
            'project-documentation.json',
            JSON.stringify(
                {
                    $schema: URI.file(path.join(dirname, path.normalize('../lib/schema/gmlDocsSchema.json'))).toString(),
                    functions: [],
                    instanceVariables: [],
                    objectsAndInstanceVariables: []
                },
                null,
                4
            )
        );
    }
github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
// Delete the objects folder
            await fse.remove(path.join(this.projectDirectory, 'objects', thisObjectYYFile.name));

            // Edit the YYP
            const ourResourceIndex = this.projectYYP.resources.findIndex(thisResource => {
                return thisResource.Key === viewUUID;
            });
            if (ourResourceIndex === -1) return null;
            this.projectYYP.resources.splice(ourResourceIndex, 1);

            await this.saveYYP();

            // Kill our document folders:
            for (const thisEvent of thisObjectYYFile.eventList) {
                const thisURI = URI.file(
                    path.join(this.projectDirectory, 'objects', thisObjectYYFile.name, this.convertEventEnumToFPath(thisEvent))
                );
                await this.removeDocumentFolder(thisURI.toString());
            }

            // Remove the resource
            delete this.projectResources[viewUUID];

            return thisObjectYYFile.name;
        } catch (e) {
            return null;
        }
    }
github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
public resourceObjectGetEventURIsFromObjectID(objID: string): string[] | null {
        // Kill without YYP
        if (!this.projectYYP) return null;

        // Find our Object Events
        const thisObjectYYFile = this.projectResources[objID];
        if (thisObjectYYFile === undefined || thisObjectYYFile.modelName !== 'GMObject') return null;

        const returnURIs: string[] = [];
        // Get our Events:
        for (const thisEvent of thisObjectYYFile.eventList) {
            const thisURI = URI.file(
                path.join(this.projectDirectory, 'objects', thisObjectYYFile.name, this.convertEventEnumToFPath(thisEvent))
            );
            returnURIs.push(thisURI.toString());
        }

        return returnURIs;
    }
github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
public async resourceEventDelete(objID: string, eventID: string): Promise {
        // Kill without YYP
        if (!this.projectYYP) return null;

        // Find our Object Events
        const thisObjectYYFile = this.projectResources[objID];
        if (thisObjectYYFile === undefined || thisObjectYYFile.modelName !== 'GMObject') return null;

        // Find our new Event:
        for (let i = 0; i < thisObjectYYFile.eventList.length; i++) {
            const thisEvent = thisObjectYYFile.eventList[i];
            if (thisEvent.id === eventID) {
                const thisURI = URI.file(
                    path.join(this.projectDirectory, 'objects', thisObjectYYFile.name, this.convertEventEnumToFPath(thisEvent))
                ).toString();
                await this.removeDocumentFolder(thisURI);

                // Update internal model
                thisObjectYYFile.eventList.splice(i, 1);

                // Write model out
                const yyFpath = path.join(this.projectDirectory, 'objects', thisObjectYYFile.name, thisObjectYYFile.name + '.yy');
                await fse.writeFile(yyFpath, JSON.stringify(thisObjectYYFile, null, 4));

                return thisURI;
            }
        }

        return null;
github GameMakerDiscord / gml-tools-langserver / src / fileSystem.ts View on Github external
private async documentCreateDocumentFolder(path: string, name: string, type: BasicResourceType, eventEntry?: EventInfo) {
        let uri = URI.file(path).toString();

        const thisDocFolder: DocumentFolder = {
            name: name,
            type: type,
            fileFullText: '',
            diagnosticHandler: null
        };

        if (eventEntry) {
            thisDocFolder.eventInfo = eventEntry;
        }

        this.documents[uri] = thisDocFolder;
    }
    //#endregion