Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow completionEntryDetails result in simple TS project #31302

Closed
mjbvz opened this issue May 7, 2019 · 9 comments · Fixed by #31354
Closed

Slow completionEntryDetails result in simple TS project #31302

mjbvz opened this issue May 7, 2019 · 9 comments · Fixed by #31354
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Domain: Performance Reports of unusually slow behavior Fixed A PR has been merged for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@mjbvz
Copy link
Contributor

mjbvz commented May 7, 2019

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:

@weswigham
Copy link
Member

simple TS project

uses styled-components

right now these appear to be mutually exclusive statements XD

@weswigham weswigham added Domain: Completion Lists The issue relates to showing completion lists in an editor Domain: Performance Reports of unusually slow behavior Needs Investigation This issue needs a team member to investigate its status. labels May 8, 2019
@jordyvandomselaar
Copy link

simple TS project

uses styled-components

right now these appear to be mutually exclusive statements XD

Hahahahaha, it's simple, for now 😂️

@johnculviner
Copy link

I have just decided to not upgrade VSC as my delay is often many seconds. It makes one of the main value propositions of the IDE unusable unless you stick on <=February

@jordyvandomselaar
Copy link

I have just decided to not upgrade VSC as my delay is often many seconds. It makes one of the main value propositions of the IDE unusable unless you stick on <=February

@johnculviner you mean vscode <= feb?

@johnculviner
Copy link

@jordyvandomselaar this is the version I'm stuck on to get acceptable performance
image

@markonyango
Copy link

I have downgraded to the February version by simply installing over the new version and am still facing the issue. Is there anything else I have forgotten to do? This is really impeding my work at the moment.

@johnculviner
Copy link

@markonyango that did it for me. Make sure to turn off auto updates though or you are right on the new version again!
image

@jordyvandomselaar
Copy link

Thanks for the replies @markonyango @johnculviner, I see @ahejlsberg has anded the "Fixed" label so all that's left is hoping for the best =), I've installed the Insiders edition as someone else noted that might help as well.

Thanks for fixing this issue guys!

@johnculviner
Copy link

Yeah thats pretty awesome when the father of C# and Typescript fixes your issue! :)

❤️❤️❤️❤️❤️ OPEN SOURCE!

Did insiders help? @jordyvandomselaar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Domain: Performance Reports of unusually slow behavior Fixed A PR has been merged for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants