-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Plan for normalizing samples #110
Comments
Update webview sample for Sample Guideline for #110
@octref Why do we use prettier and not our formatters? Apart from an extra config file, this looks like we are telling the world "Don't use our stuff" |
|
No, I use the default formatter options, e.g for TypeScript. Now prettifier makes TypeScript code look different then TypeScript makes it look and that's wrong if you ask me.
These are samples right? Why would anyone want to format them from the CLI?
You don't need tsfmt, just the default TypeScript settings that we ship with the tool |
I also have different opinions on code style...I think the goal of a sample repo is consistency in code style, and prettier enforces the same style much better than TS formatter in my experience.
This allows me to run
The only way to enforce style in local setting (as user might have changed his user-level TS formatting setting), is to replicate the whole set of |
@jrieken I dropped the formatter requirement for this milestone. Let's discuss later. {
"rules": {
"indent": [true, "tabs"],
"semicolon": [true, "always"]
}
} I just did 3 LSP samples in 15 minutes. @Microsoft/vscode, if you are assigned for any samples, please take some time to update your samples. Otherwise, they will not end up in the listing on website and the README. |
my problem is that I ended up more or less rewriting the sample cos I didn't like it anymore... still, the outcome is an improvement. @octref in the |
The user would surely appreciate the update!
I don’t want to list registerCommand for each sample. But if you do want to list all API calls that’s fine for me. |
Shouldn't we clean the code as well and add the following compiler options? "strictNullChecks": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true
|
I have added a tsconfig.base.json to the root of the samples repository. |
Better base:
|
In addition we should convert the tsc compile to use |
Our source code should have the MS copyright. Currently missing in the hello world.
|
And we should remove "use strict"; from the TS files since it is emitted automatically if es6 targets are use or if --strict is used. |
|
People would open each sub directory as an independent workspace, so I do hope each subfolder contains everything. When we have microsoft/vscode-generator-code#114, people can generate an extension starter template using the samples too. They won't necessarily checkout the whole vscode-extension-samples.
We can do that for all the LSP samples and normalize them.
The samples cater to a lot of people who might not be familiar with TS, so I hope the setting could be as relaxing as possible, so people can get started quickly instead of being bogged down by type errors.
I just did that for all samples.
Can I remove all of that too? We'll have a single top-level LICENSE / ThirdPartyNotice. I hope beginners can look at code and understand the ideas, not being reminded constantly all these code are owned by Microsoft. |
@octref Should we make I have already created a |
📍 We have completed the circle 147c680 |
@sandy081 Please no, no one finds multi-root workspace with 20 roots useful. You type The saddest part is then you find 5 more samples that's not shown in Quick Open or Search because people writing samples forgot to add them. |
If it was discussed before and decided to remove the MR workspace file, sorry as I am not aware.
@octref I think users have same issues when they open
Following are the disadvantages now
MR workspace will help with issues 1 & 2. Point 3 will be a good feature request for MR workspaces. Not sure if it makes sense to have this feature in single folder workspaces.
Not sure what you mean. How is MR workspace is related here?
Is not it a general issue for MR workspace users? It would be great if VS Code helps them in such cases? |
I should have added more instructions. The intended workflow is:
Here are some lists that never get updated: https://github.com/Microsoft/vscode-extension-samples/blob/4524d2ae9d7c458baee22cc717e95c6ac98b0315/package.json#L6-L12 Here's a postinstall script at root that tries to run
Showing 20 debug targets, and when user try to locate
Not really, git works as it is.
Also there's my hope of making each sample a self-contained folder, able to serve as a starting point for making new extensions. See microsoft/vscode-generator-code#114. |
In short, the hope is user finds a sample he's interested in and focus on it, not that he constantly get reminded he's in a MR workspace with 20 roots whenever he does Cmd+P, F5, Search, Open New Terminal, etc. |
If we use |
@octref After discussions I dropped the idea of making this MR workspace and make it single example specific. |
@alexandrudima Good suggestion. Did that for all samples, except |
Is it possible to add tests to the webpack example? I managed to get my extension working, but I can't figure out how to build/run the tests now. It should be possible to run the tests against the packed version of the extension (both from VS Code with F5 and on Travis etc.) but I'm not sure how. |
@joaomoreno just wrote up this https://code.visualstudio.com/docs/extensions/testing-extensions#_continuous-integration and maybe he could help? |
@DanTup Can you give Azure Pipelines a try and let me know if you hit any problems with it? |
@octref @joaomoreno My issue isn't really about setting up CI, it's before that - I'm not sure how It'd really help if the webpack sample was based on the normal hello_world extension that has some tests in it. (and also, it should be ready for running |
Maybe @jrieken has some insights. |
While I am updating my sample I really question the use of TSLint. My samples are ~30 lines of code, a user open this and immediately sees an (annoying) prompt to install a recommended extension. Just so that after a restarting everything looks exactly like it did before. What are we trying to achieve here? Yeah, I am friend of consistency but we are really throwing sticks at those people that wanna use the sample. First, we make them npm-install more than needed, then we make them install an extension which will only complain about the changes the user makes (since our stuff is already lint'ed). So, should using tabs and always having semicolons really be part of the learning experience? I understand that we wanna provide "good looking" samples but now we just create PITA for those that use it. So we need to find a better way to enforce consistency (pre commit hook) and not force extensions and more config upon our users. |
@jrieken I think a good middle ground is:
|
Shipped. |
I posted above about adding tests to the webpack sample but that wasn't done - should I open a new issue about it? I still can't figure out how tests should be configured when packing an extension (see #110 (comment)). |
@DanTup If microsoft/vscode-docs#2254 doesn't cover what you want, feel free to append to that issue or open a new one. |
@octref That issue seems relevant so I've added a comment on to there - thanks! |
In the new API doc, sample is tightly integrated into the API docs:
HelloCode
sample will be thoroughly illustrated in https://vscode-ext-docs.azurewebsites.net/api/get-started/your-first-extension.The samples become an important resource for people to explore VS Code API. We should try to make the samples
HelloCode
sample, which we suppose each Extension API reader will become familiar with.This task is for you to update your sample to meet the Sample Guideline. It shouldn't take more than 20 minutes for you.
Please work on the.ext-docs
branchext-docs
branch has been merged tomaster
. Work onmaster
branch.I did a PR to update the webview sample: #111. The sample and the Webview Guide tie nicely together now.
Deferred: Please finish this during debt week.
extension-deps-sample @sandy081smart-template-strings-sample @jriekenThe text was updated successfully, but these errors were encountered: