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

feat: Provides 'Adding a Visual Studio Code Extension' module #2265

Merged
merged 12 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/end-user-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
** xref:investigating-failures-at-a-workspace-start-using-the-verbose-mode.adoc[]
** xref:troubleshooting-slow-workspaces.adoc[]
** xref:troubleshooting-network-problems.adoc[]
* xref:adding-a-vscode-extension.adoc[]
163 changes: 163 additions & 0 deletions modules/end-user-guide/pages/adding-a-vscode-extension.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
:navtitle: Adding a Visual Studio Code extension to a workspace
:keywords: Visual Studio Code extension, user-guide

[id="adding-visual-studio-code-extension_{context}"]
= Adding a Visual Studio Code extension to a workspace

Devfiles in the devfile v2 format don't contain any IDE-specific plug-ins or Visual Studio Code extensions. Instead, the plug-ins and extensions are described in a specific meta-folder.

[id="plug-in-registries"]
== {prod-short} plug-in registries overview

{prod-short} has a default plug-in and extensions registry installed in every {prod-short} instance. The Che-Theia IDE searches and installs the plug-ins and extensions from that location.

Check this {prod-short} https://github.com/eclipse-che/che-plugin-registry[registry project] for an overview of default plug-ins, extensions, and source code. An online instance that is refreshed after every commit to the main branch, is located https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/[here]. You can use a different plug-in or extension registry for Che-Theia if you don't work in air gap mode: only the default registry is available there.
Copy link
Contributor

Choose a reason for hiding this comment

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

In some che-docs topics, link: precedes URLs like this, but not in this PR. Is that okay?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Check this {prod-short} https://github.com/eclipse-che/che-plugin-registry[registry project] for an overview of default plug-ins, extensions, and source code. An online instance that is refreshed after every commit to the main branch, is located https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/[here]. You can use a different plug-in or extension registry for Che-Theia if you don't work in air gap mode: only the default registry is available there.
Check this {prod-short} https://github.com/eclipse-che/che-plugin-registry[registry project] for an overview of [the?] default plug-ins, extensions, and source code. An online instance that refreshes after every commit to the main branch is located https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/[here]. You can use a different plug-in or extension registry for Che-Theia if you don't work in air gap mode: only the default registry is available there.

Copy link
Contributor

@rolfedh rolfedh Apr 6, 2022

Choose a reason for hiding this comment

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

I'm having trouble making sense of the final sentence.

  • I don't see an "air gap mode" mentioned in the che-docs. Would it help to say "air-gapped environment", link to a topic, or specify the key parameters for setting up an air-gapped environment, such as airGapContainerRegistryHostname?
  • @benoitf, does "only the default registry is available there" mean "only the default registry is available in an air-gapped environment?" This seems like the opposite of what I would expect. I expect the user would need to specify a custom (non-default) plug-in or extension registry because they are in an air-gapped environment. The default URLs of the plug-ins and extensions might not be reachable from an air-gapped system.

Copy link
Contributor

@rolfedh rolfedh Apr 6, 2022

Choose a reason for hiding this comment

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

Using the definite article, "the default plug-ins", makes more sense if the "registry project" topic describes specific plug-ins. Otherwise, if it's an abstract discussion of "plug-ins, extensions, and source code," the current wording is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'air gap' is also named 'restricted environment' sometimes. But you can find definition there https://en.wikipedia.org/wiki/Air_gap_(networking)

And it's used in Che (and docs)

Copy link
Contributor

@rolfedh rolfedh Apr 7, 2022

Choose a reason for hiding this comment

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

'air gap' is also named 'restricted environment' sometimes. But you can find definition there https://en.wikipedia.org/wiki/Air_gap_(networking)

And it's used in Che (and docs)

Although we should strive to use the terminology consistently, I'm not highlighting "air gap" as a problem. I'm concerned that calling it a "mode" might prompt users to search for an actual software mode when it seems like there might not be one. I'm guessing you mean "an air-gapped or restricted environment" instead.

Otherwise, if there is something like a mode, it's not called a "mode" in the software or documentation and actually consists of one or more parameters that the user must set when operating the software in a restricted environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll accept any suggested changes but here suggested changes have questions so I never saw this kind of suggested changes.

Does "only the default registry is available there" mean "only the default registry is available in an air-gapped environment?" This seems like the inverse of what I would expect: That the user probably requires use of a custom plug-in or extension registry because they are in an air-gapped environment. The default URLs of the plug-ins and extensions might not be reachable from an air-gapped system.

There is no need to use a custom plug-in or extension registry. Che deploy a registry on the air-gapped environment and in that case it includes all the binaries so there is no need to fetch something externally.

The default URLs of the plug-ins and extensions might not be reachable from an air-gapped system.

everything is reachable in that case (we build and deploy an offline / air-gapped environment registry)

Copy link
Contributor

Choose a reason for hiding this comment

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

wording fixed


The plug-in and extension overview for Che-Code Visual Studio Code editor is located in the https://www.open-vsx.org/[OpenVSX instance]. Air gap mode is not yet supported for this editor.

[id="visual-studio-code-extensions-json"]
== Adding an extension to `.vscode/extensions.json`

The easiest way to add a Visual Studio Code extension to a workspace is to add it to the `.vscode/extensions.json` file. The main advantage of this method is that it works with all supported {prod-short} IDEs.

If you use the Che-Theia IDE, the extension is installed and configured automatically. If you use a different supported IDE with the Che-Code Visual Studio Code fork, a pop-up with a recommendation to install the extension shows when you start the workspace.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you use the Che-Theia IDE, the extension is installed and configured automatically. If you use a different supported IDE with the Che-Code Visual Studio Code fork, a pop-up with a recommendation to install the extension shows when you start the workspace.
If you use the Che-Theia IDE, the extension is installed and configured automatically. If you use a different supported IDE with the Che-Code Visual Studio Code fork, the IDE [displays a pop-up with a recommendation/promts you] to install the extension when you start the workspace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GitHub suggestion implies that we can commit directly the change.
Here it looks that there are two suggestions so it should be two separate GitHub PR suggestions (and people can approve one of them)

Copy link
Contributor

Choose a reason for hiding this comment

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

wording fixed


.Prerequisites
. You have the `.vscode/extensions.json` file in the root of the GitHub repository.

.Procedure
. Add the extension id to `.vscode/extensions.json` file. Use a `.` sign to separate the publisher and extension names:
+
*EXAMPLE*
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't find any other instances of *EXAMPLE* in che-docs. Consider adopting the standard code block titles throughout, like this:

.Example <optional descriptive text>

Copy link
Contributor

Choose a reason for hiding this comment

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

formatting fixed

[source,json,subs="+quotes"]
----
{
"recommendations": [
"redhat.java"
]
}
----

*NOTE*
Copy link
Contributor

Choose a reason for hiding this comment

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

For comparison, I searched the che-docs repo for admonitions like one this but didn't find any. You can use the asciidoc formatting for admonitions, which looks like this:

NOTE: adlfjakdfj

or

[NOTE]
====
afdasdf
====

The openshift-docs repo standardized on this later format...
I would recommend asking your team which one to use.

Copy link
Contributor

@rolfedh rolfedh Apr 7, 2022

Choose a reason for hiding this comment

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

This is how asciidoc renders the original format and the two proposed formats:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

formatting fixed

If the specified set of extension ids isn't available in the {prod-short} registry, the workspace starts without the extension.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/id/ID/ throughout.

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed



[id="che-theia-plug-ins-YAML"]
== Adding plug-in parameters to `.che/che-theia-plugins.yaml`
You can add extra parameters to a plug-in by modifying the `.che/che-theia-plugins.yaml` file. These modifications include:
Copy link
Contributor

Choose a reason for hiding this comment

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

Bulleted lists don't render as such unless they're preceded by a blank line.

Copy link
Contributor

Choose a reason for hiding this comment

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

formatting fixed

* Defining the plug-ins for workspace installation.
* Changing default memory limit.
* Overriding default preferences.


=== Defining the plug-ins for workspace installation
Define the plug-ins to be installed in the workspace.

.Prerequisites
. You have the `.che/che-theia-plugins.yaml` file in the root of the GitHub repository.

.Procedure
. Add the id of the plug-in in the `.che/che-theia-plugins.yaml` file. Use the `/` sign to separate the publisher and plug-in name:
+
*EXAMPLE*
[source,yaml,subs="+quotes"]
----
- id: redhat/java
----

=== Changing default memory limit

Override container settings such as the memory limit.

.Prerequisites
. You have the `.che/che-theia-plugins.yaml` file in the root of the GitHub repository.

.Procedure
. Add an `override` section in the `.che/che-theia-plugins.yaml` file under the `id` of the plug-in.
Copy link
Contributor

Choose a reason for hiding this comment

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

add...to

Copy link
Contributor

Choose a reason for hiding this comment

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

wording fixed

. Specify the memory limit for the extension. In the following example, {prod-short} automatically installs the Red Hat Visual Studio Code Java extension in the {prod-short} workspace and increases the memory of the workspace by two gigabytes:
+
*EXAMPLE*
[source,yaml,subs="+quotes"]
----

- id: redhat/java
override:
sidecar:
memoryLimit: 2Gi
----

=== Overriding default preferences

Override the default preferences of the Visual Studio Code extension for the workspace.

.Prerequisites
. You have the `.che/che-theia-plugins.yaml` file in the root of the GitHub repository.

.Procedure
. Add an `override` section in the `.che/che-theia-plugins.yaml` file under the `id` of the extension.
Copy link
Contributor

@rolfedh rolfedh Apr 7, 2022

Choose a reason for hiding this comment

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

"add...to" here and elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

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

wording fixed

. Specify the preferences in the `Preferences` section. In the following example, {prod-short} automatically installs Red Hat Visual Studio Code Java extension in the {prod-short} workspace and sets the `java.server.launchMode` preference to `LightWeight`.
+
*EXAMPLE*
[source,yaml,subs="+quotes"]
----
- id: redhat/java
override:
preferences:
java.server.launchMode: LightWeight
----

*NOTE* You can also define the preferences in the `.vscode/settings.json` file, either by changing the preferences in the UI of your IDE or by manually adding them to the `.vscode/settings.json` file:
[source,json,subs="+quotes"]
----
{
"my.preferences": "my-value"
}
----

[id="visual-studio-code-extensions-in-devfile"]
== Defining Visual Studio Code extension attributes in the devfile

In case it's not possible to add extra files in the GitHub repository, you can define some of the plug-in or extension attributes by inlining them in the devfile. You can use this procedure with both `.vscode/extensions.json` and `.che/che-theia-plugins.yaml` file contents.
Copy link
Contributor

@rolfedh rolfedh Apr 7, 2022

Choose a reason for hiding this comment

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

For minimalism:

  • In case > If ?
  • it's not possible to > you can't ?

Is there a more commonly understood equivalent for "inlining" that preserves the meaning?

Copy link
Contributor

Choose a reason for hiding this comment

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

wording fixed


=== Inlining `.vscode/extensions.json` file
Use `.vscode/extensions.json` file contents to inline extension attributes in the devfile.
Copy link
Contributor

Choose a reason for hiding this comment

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

Part of the issue with using the adjective, "inline," as a verb is that when you use it next to a noun, as shown here, the reader might experience some semantic noise:
raising the question, "Is a verb missing between "to" and "inline extension attributes?"
Perhaps subsitute it with "add" or "insert?" WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

reworded as "inlining the extension/plug-in attributes"


.Procedure
. Add an `attributes` section in your `devfile.yaml` file.
. Add `.vscode/extensions.json` in the `atributes` section. Add a `|` sign after the colon separator.
. Paste the contents of the `.vscode/extensions.json` file after the `|` sign. The following example uses Red Hat Visual Studio Code Java extension attributes:
+
*EXAMPLE*
[source,yaml,subs="+quotes"]
----
schemaVersion: 2.2.0
metadata:
name: my-example
attributes:
.vscode/extensions.json: |
{
"recommendations": [
"redhat.java"
]
}
----

=== Inlining `.che/che-theia-plugins.yaml` file
Use `.che/che-theia-plugins.yaml` file contents to inline plug-in attributes in the devfile.

.Procedure
. Add an `attributes` section in your `devfile.yaml` file.
. Add `.vscode/extensions.json` in the `atributes` section. Add a `|` sign after the colon separator.
. Paste the content of the `.che/che-theia-plugins.yaml` file after the `|` sign. The following example uses Red Hat Visual Studio Code Java plug-in attributes:
+
*EXAMPLE*
[source,yaml,subs="+quotes"]
----
schemaVersion: 2.2.0
metadata:
name: my-example
attributes:
.che/che-theia-plugins.yaml: |
- id: redhat/java
----