Show whole truncated type in vscode & vim

vscode type truncation

I’ve been working with some fairly large types on a recent project and vscode (coc typescript with vim) will automatically truncate the type when it’s over 160 characters. This is a pretty painful deadend when inspecting a type and the workaround isn’t the simplest.

I initially tired setting the noErrorTruncation option to true in my tsconfig.json as described in the accepted answer here and while this does work, it stops at 160 characters.

Turns out the solution to override this hard limit is to manually update vscode’s tsserver source code. If your running vim, find the tsserver coc is using.

For me I found this file (on a Mac) at the location /Applications/Visual\ Studio\

You’ll then want to update the ts.defaultMaximumTruncationLength var to your wanted amount, note that the larger it is, the higher the chance of the process crashing.


(function (ts) {
    ts.resolvingEmptyArray = [];
    ts.externalHelpersModuleNameText = "tslib";
    ts.defaultMaximumTruncationLength = 2000;
    ts.noTruncationMaximumTruncationLength = 180;
    function getDeclarationOfKind(symbol, kind) {