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

Custom completer example #169

Merged
merged 25 commits into from
Aug 3, 2021
Merged

Custom completer example #169

merged 25 commits into from
Aug 3, 2021

Conversation

ohrely
Copy link
Contributor

@ohrely ohrely commented Jul 13, 2021

Adds a basic example for customizing notebook completer functionality.

Inadvertently addresses #156 by disabling the notebooks plugin.

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks for this great example @ohrely

Some general comment, could you upgrade the example to use the latest cookiecutter template?
You can achieve that thanks to scripts/upgrade_extensions.py

Could you add a note in the readme on the disabling core extension feature you are using?

For the tests, there is a bug in the ci for the other examples (fixed by #170). For your example, you need to have some configuration files matching the one in hello world - it should be ok one you upgrade all extensions. And you need to insert the code snippets in the readme using jlpm run embedme at the root examples folder.

@ohrely
Copy link
Contributor Author

ohrely commented Jul 15, 2021

Some general comment, could you upgrade the example to use the latest cookiecutter template?
You can achieve that thanks to scripts/upgrade_extensions.py

@fcollonval When I run this script, it makes modifications to setup.py and package.json in several of the example extensions and adds RELEASE.md to every extension. Is this the correct behavior?

@fcollonval
Copy link
Member

Is this the correct behavior?

Yes this is expected as new commits have been pushed to the template project recently. If you can ignore those in the other extensions, it will be appreciated (so this PR keeps focusing on the new example alone).

@ohrely
Copy link
Contributor Author

ohrely commented Jul 16, 2021

The two build_all tests are failing because one inserted code snippet is getting "corrected" by pre-commit linting, so it no longer matches the (more indented) source of the snippet. Is there a preferred way to address this?

I'm not sure what to make of the three failing build_extensions checks.

@fcollonval
Copy link
Member

fcollonval commented Jul 17, 2021

Thanks for pushing forward

To fix the linter error in the Readme, you should wrap the code snippets between special comments; e.g.

<!-- prettier-ignore-start -->
```ts // src/index.ts#L12-L14 

activate: (app: JupyterFrontEnd) => { 
console.log('the JupyterLab main application:', app); 
}, 
`` ` 
<!-- prettier-ignore-end -->

Regarding the remaining error in the new example, you need to overwrite tsconfig.json, .eslintrc.js, .eslintignore and .gitignore with those in the hello-world example (this is to ensure homogenous config).

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks @ohrely I push a commit to fix all linter troubles to go forward. I have two comments in the code and one general one: could you use you instead of we in the readme?

completer/README.md Outdated Show resolved Hide resolved
completer/README.md Outdated Show resolved Hide resolved
@hbcarlos
Copy link
Member

Hi @ohrely and @fcollonval, I rebased from master and added a basic test.

I'll update the extension to JupyterLab v3.1 too.

@fcollonval
Copy link
Member

@hbcarlos thanks for pushing this one. Could you please add a more advanced ui test that open a notebook, trigger the completer and check the suggestions are the one expected?

@hbcarlos
Copy link
Member

hbcarlos commented Aug 2, 2021

@fcollonval I'm not sure where the CI test fail. Do you have any advice?

@fcollonval
Copy link
Member

We are getting closer 🙃

The integration test needs to be more robust. Did you try to run it locally before running it in the ci?
Two ideas, the kernel may not be ready when you hit tab. So waiting for the idle state could be good. The other one is that I had some trouble with codemirror edition that I circumvent by using page.keyboard - see settings example.

@hbcarlos
Copy link
Member

hbcarlos commented Aug 3, 2021

Thanks for the advice, @fcollonval! Yes, I tested locally before pushing to CI.

@hbcarlos
Copy link
Member

hbcarlos commented Aug 3, 2021

Btw, when running locally, If you don't run npx playwright install first, the test fails because chromium is not installed.

@fcollonval
Copy link
Member

Thanks @hbcarlos

I updated the test to trigger the custom completion and make it more robust.
Plus I catched some missing package not listed in dependencies.

@fcollonval fcollonval self-requested a review August 3, 2021 10:27
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Let's merge
Thanks a lot @ohrely and @hbcarlos

@fcollonval fcollonval merged commit b41f2c1 into jupyterlab:master Aug 3, 2021
@hbcarlos
Copy link
Member

hbcarlos commented Aug 3, 2021

Thanks to you for all the help!!

@ohrely
Copy link
Contributor Author

ohrely commented Aug 4, 2021

Thank you both!

@ohrely ohrely deleted the completer branch August 4, 2021 20:38
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.

3 participants