Change:
1, 48, 53, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (6 << MetadataConsts.FOREGROUND_OFFSET)), 2, 12, 20, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (7 << MetadataConsts.FOREGROUND_OFFSET)), 2, 31, 36, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (8 << MetadataConsts.FOREGROUND_OFFSET)), <del> 2, 36, 41, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (9 << MetadataConsts.FOREGROUND_OFFSET)), </del> <ins> 2, 38, 39, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (9 << MetadataConsts.FOREGROUND_OFFSET)), ])); assert.deepStrictEqual(result.toString(), expected.toString()); }); test('issue #148651: VSCode UI process can hang if a semantic token with negative values is returned by language service', () => { const languageId = 'dockerfile'; disposables.add(languageService.registerLanguage({ id: languageId })); const legend = { tokenTypes: ['st0', 'st1', 'st2', 'st3', 'st4', 'st5', 'st6', 'st7', 'st8', 'st9'], tokenModifiers: ['stm0', 'stm1', 'stm2'] }; instantiationService.stub(IThemeService, <Partial<IThemeService>>{ getColorTheme() { return { getTokenStyleMetadata: (tokenType, tokenModifiers, languageId): ITokenStyle => { return { foreground: parseInt(tokenType.substr(2), 10), bold: undefined, underline: undefined, strikethrough: undefined, italic: undefined }; } }; } }); const styling = instantiationService.createInstance(SemanticTokensProviderStyling, legend); const badTokens = { data: new Uint32Array([ 0, 0, 3, 0, 0, 0, 4, 2, 2, 0, 0, 2, 3, 8, 0, 0, 3, 1, 9, 0, 0, 1, 1, 10, 0, 0, 1, 4, 8, 0, 0, 4, 4294967292, 2, 0, 0, 4294967292, 4294967294, 8, 0, 0, 4294967294, 1, 9, 0, 0, 1, 1, 10, 0, 0, 1, 3, 8, 0, 0, 3, 4294967291, 8, 0, 0, 4294967291, 1, 9, 0, 0, 1, 1, 10, 0, 0, 1, 4, 8, 0 ]) }; const result = toMultilineTokens2(badTokens, styling, languageId); const expected = SparseMultilineTokens.create(1, new Uint32Array([ 0, 4, 6, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (1 << MetadataConsts.FOREGROUND_OFFSET)), 0, 6, 9, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (2 << MetadataConsts.FOREGROUND_OFFSET)), 0, 9, 10, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (3 << MetadataConsts.FOREGROUND_OFFSET)), 0, 11, 15, (MetadataConsts.SEMANTIC_USE_FOREGROUND | (4 << MetadataConsts.FOREGROUND_OFFSET)), </ins> ])); assert.deepStrictEqual(result.toString(), expected.toString()); });

Discussion:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes/No <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.66.2 OS Version: Win11 (but presumably affects all OSs) See , Steps to Reproduce: the Docker extension installed, open the Dockerfile example from , or simply enter this into a Dockerfile: VSCode freezing up We are independently working on the issue where negative-valued semantic tokens are returned, but invalid token data from the language service should not be causing VSCode to freeze up.
/cc
I'm not very familiar with semantic tokens, so if there's more info you can add here feel free!
I've tried reproducing this in a simple VS Code extension but have not had much luck. I do not see anything obvious in the LSP client bridge code so I feel like it should be reproducible in a regular extension also...
Yes, agree. This should be reproducible in a VS Code extension also.
Thanks for the speedy fix!