Skip to content

Slow completionEntryDetails result in simple TS project #31302

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#73311

TypeScript Version: 3.5.0-dev.20190507

Search Terms:

  • suggestion
  • completionEntryDetails
  • tsserver

Repo

git clone https://github.com/mjbvz/vscode-73311
cd vscode-73311
npm install
code-insiders .
  1. Open index.js and try triggering suggestions after Flex by deleting the trailing x then typing it again

The project uses styled components:

import styled from "styled-components";

type Justify = "space-around" | "space-between";

export const FlexBox = styled.div<{
    column?: boolean;
    justify?: Justify;
}>`
  display: flex;
  flex-direction: ${props => (props.column ? "column" : "row")};
  ${props => !!props.justify && `justify-content: ${props.justify}`}
`;

export const Flex = styled.div<{ flex?: number }>`
  flex: ${props => props.flex || 1};
`; 

Bug
The completionEntryDetails request this triggers can often take half a second or longer to process:

Info 214  [15:56:42.198] request:
    {"seq":37,"type":"request","command":"completionEntryDetails","arguments":{"file":"/Users/matb/projects/san/index.ts","line":1,"offset":5,"entryNames":[{"name":"Flex","source":"/Users/matb/projects/san/components"}]}}
Info 215  [15:56:42.199] getCompletionData: Get current token: 0
Info 216  [15:56:42.199] getCompletionData: Is inside comment: 0
Info 217  [15:56:42.199] getCompletionData: Get previous token 1: 0
Info 218  [15:56:42.199] getCompletionData: Get previous token 2: 0
Info 219  [15:56:42.202] getCompletionData: Semantic work: 3
Perf 220  [15:56:43.103] 37::completionEntryDetails: elapsed time (in milliseconds) 905.5459
Info 221  [15:56:43.105] response:
    {"seq":0,"type":"response","command":"completionEntryDetails","request_seq":37,"success":true,"body":[{"name":"Flex","kindModifiers":"export","kind":"const","displayParts":[{"text":"const","kind":"keyword"},{"text":" ","kind":"space"},{"text":"Flex","kind":"localName"},{"text":":","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"StyledComponent","kind":"aliasName"},{"text":"<","kind":"punctuation"},{"text":"\"div\"","kind":"stringLiteral"},{"text":",","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"any","kind":"keyword"},{"text":",","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"{","kind":"punctuation"},{"text":"\n","kind":"lineBreak"},{"text":"    ","kind":"space"},{"text":"flex","kind":"propertyName"},{"text":"?","kind":"punctuation"},{"text":":","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"number","kind":"keyword"},{"text":";","kind":"punctuation"},{"text":"\n","kind":"lineBreak"},{"text":"}","kind":"punctuation"},{"text":",","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"never","kind":"keyword"},{"text":">","kind":"punctuation"}],"documentation":[],"codeActions":[{"description":"Import 'Flex' from module \"./components\"","changes":[{"fileName":"/Users/matb/projects/san/index.ts","textChanges":[{"start":{"line":1,"offset":1},"end":{"line":1,"offset":1},"newText":"import { Flex } from \"./components\";\n\n"}]}]}],"source":[{"text":"./components","kind":"text"}]}]}

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Completion ListsThe issue relates to showing completion lists in an editorDomain: PerformanceReports of unusually slow behaviorFixedA PR has been merged for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions