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

fix: improve the user experience about lg editor #3337

Merged
merged 31 commits into from
Jun 17, 2020

Conversation

lei9444
Copy link
Contributor

@lei9444 lei9444 commented Jun 5, 2020

Description

The lg parser takes a long time to parse a large file(20k lines will take 115s). And some lg template related functions are in UI thread. So the ui is blocked by the parser.

Now

  • move all parser function to web worker. complex calculation will not block the UI thread
  • update the botbuild-lg version. The parse time decreases from 115s to 10s (20k lines).
  • add worker for lg lsp to parse the lg file
    But there is still an issue, the text in dialog will take a long time to show the update:
    test1

Task Item

refs #3295
refs #3314

Screenshots

@coveralls
Copy link

coveralls commented Jun 5, 2020

Coverage Status

Coverage decreased (-0.04%) to 48.021% when pulling 6fc46a5 on lei9444:lgperf into 0bbab12 on microsoft:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) to 40.409% when pulling 173b91c on lei9444:lgperf into 069fe49 on microsoft:master.

@a-b-r-o-w-n a-b-r-o-w-n self-requested a review June 10, 2020 22:45
a-b-r-o-w-n
a-b-r-o-w-n previously approved these changes Jun 10, 2020
Copy link
Contributor

@a-b-r-o-w-n a-b-r-o-w-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now.

@boydc2014
Copy link
Contributor

@lei9444 please fix the UT

boydc2014
boydc2014 previously approved these changes Jun 11, 2020
@boydc2014
Copy link
Contributor

=============================== Coverage summary ===============================
Statements : 50.61% ( 4719/9325 )
Branches : 41.03% ( 1871/4560 )
Functions : 45.29% ( 1072/2367 )
Lines : 51.1% ( 4495/8797 )

Test Suites: 149 passed, 149 total
Tests: 575 passed, 575 total
Snapshots: 6 passed, 6 total
Time: 203.488 s
Ran all test suites in 10 projects.
Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with --detectOpenHandles to troubleshoot this issue.
##[error]The operation was canceled.

I saw the UT passed, but somehow it get canceled.

Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor issues, but other than that it looks good to me. 👍

Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems good now! Nice job :shipit:

@@ -53,7 +53,7 @@
"runtime": "cd ../runtime/dotnet/azurewebapp && dotnet build && dotnet run",
"test": "yarn typecheck && jest",
"test:watch": "yarn typecheck && jest --watch",
"test:coverage": "yarn test --coverage --no-cache --reporters=default",
"test:coverage": "yarn test --coverage --no-cache --forceExit --reporters=default",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to solve the tests somehow not exits propertly in CI envivonment like i listed above


afterEach(() => {
delete process.env.NODE_ENV;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the node env already test when running tests? This doesn't seem right.

@@ -8,15 +8,15 @@
"build:demo": "cd demo && tsc --build tsconfig.json",
"prepublishOnly": "npm run build",
"clean": "rimraf lib demo/dist",
"start": "cd demo && ts-node ./src/server.ts",
"start": "cd demo && set NODE_ENV=development&& ts-node ./src/server.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't cross platform friendly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-b-r-o-w-n this got fixed already with cross-env

@cwhitten cwhitten merged commit fd6b3c8 into microsoft:master Jun 17, 2020
@cwhitten cwhitten mentioned this pull request Jul 8, 2020
} catch (error) {
// ignore if file not exist
}
}

const id = fileId || uri;
const { allTemplates, diagnostics } = Templates.parseText(content, id, importResolver);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we still need allTemplates for intelligent suggestions (items in imported file)

@lei9444 lei9444 deleted the lgperf branch August 26, 2020 07:59
lei9444 added a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* move lg api into worker

* output worker files with readable names

* update the version of botbuild-lg

* remove promise in parse event

* refacotr lg worker to catch all errors

* add worker for lg lsp

* add a null check when rejecting

* dissallow node integration in worker threads

* remove request_light

* update worker file naming

* fix unit test

* set asar = false

* add force exit for jest

* move node_module to unpack folder

* Swapped out server side worker with child process.

* fix unit tests in lg lsp

* clean the code

* only support test env in lg lsp

* fix some comments

* update the dev dependency

Co-authored-by: Andy Brown <asbrown002@gmail.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: Tony Anziano <tonyanziano5@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants