Skip to content

Commit d436029

Browse files
How to develop with YAML LS and VSCode together.
Let me know if anything is incorrect.
1 parent 20ebdd7 commit d436029

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ some_mapping: !Mapping-example
6969
some_mapping_key_2: some_mapping_value_2
7070
```
7171
72-
##### Associating a schema to a glob pattern via yaml.schemas:
72+
##### Associating a schema to a glob pattern via yaml.schemas:
7373
yaml.schemas applies a schema to a file. In other words, the schema (placed on the left) is applied to the glob pattern on the right. Your schema can be local or online. Your schema must be a relative path and not an absolute path.
7474
7575
When associating a schema it should follow the format below
@@ -138,6 +138,37 @@ This extension allows you to specify json schemas that you want to validate agai
138138
1. Open the client in vscode
139139
2. Make changes as neccessary and the run the code using F5
140140

141+
##### Developing the client and server together
142+
1. Download both the [Yaml Language Server](https://github.com/redhat-developer/yaml-language-server) and this VSCode Yaml Client.
143+
144+
2. Create a project with the directories in the following structure.
145+
```
146+
ParentFolder/
147+
├──── vscode-yaml/
148+
├──── yaml-language-server/
149+
```
150+
3. Run `npm install` in both directories to initialize `node_modules` dependencies.
151+
4. In `vscode-yaml/src/extension.ts` set the `serverModule` variable to:
152+
```ts
153+
serverModule = context.asAbsolutePath(path.join("..", "yaml-language-server", "out", "server", "src", "server.js"));
154+
```
155+
_This will redirect which YAML LS to use._
156+
157+
5. In BOTH directories run:
158+
```bash
159+
npm run compile
160+
```
161+
162+
6. To run the language server in VSCode, click `View -> Debug`, then from the drop down menu beside the green arrow select `Launch Extension (vscode-yaml)`, click the arrow, and a new VSCode window should load with the YAML LS running.
163+
164+
7. To debug the language server in VSCode, from the same drop down menu
165+
select
166+
`Attach (yaml-language-server)`, and click the green arrow to start.
167+
Ensure you've opened a YAML file or else the server would have not yet
168+
started.
169+
170+
**Note:** Disable or remove any existing implementations of the YAML Language server from VSCode or there will be conflicts.
171+
141172
##### Developing the server side
142173
1. To develop the language server visit https://github.com/redhat-developer/yaml-language-server
143174

0 commit comments

Comments
 (0)