Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support large documents in extension host #31078

@emackey

Description

@emackey
  • VSCode Version: 1.14.1
  • OS Version: Windows 7 and Windows 10, likely all OSes

When editing documents with very long lines, such as lines containing data-URIs, the property vscode.window.activeTextEditor will be undefined when it should be defined.

Steps to reproduce:

  1. Create a new (blank) VSCode extension, and add this command to extension.ts:
'use strict';
import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
    let disposable = vscode.commands.registerCommand('bigDocTest.runDocTest', () => {

        let hasActiveTextEditor = (vscode.window.activeTextEditor !== undefined);

        if (hasActiveTextEditor) {
            vscode.window.showInformationMessage('Success, activeTextEditor is defined.');
        } else {
            vscode.window.showErrorMessage('Oops, activeTextEditor is not defined.');
        }
    });

    context.subscriptions.push(disposable);
}

export function deactivate() {
}
  1. Launch this extension, load any normal text file, and run this command, you see the "Success, activeTextEditor is defined" information message appear.

  2. But, try loading a file with a very long line contained inside it, such as this one: MetalRoughSpheres.gltf. This file has long lines due to the use of embedded data URIs in the file. If you run the above sample extension while editing this file, you see "Oops, activeTextEditor is not defined."

This makes it difficult for VSCode extensions to work with such files. I'm the lead dev of the GLTF extension for VSCode, and this prevents my extension from running on GLTF files that embed large images as data URIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions