Skip to content

Commit

Permalink
Merge pull request #8 from adamvoss/multipleDocuments
Browse files Browse the repository at this point in the history
Support multiple documents
  • Loading branch information
adamvoss authored Jul 19, 2017
2 parents 45fea57 + 4cdf3ee commit 788fc62
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 0.0.7
- Add support for multiple documents in a single file.

## 0.0.6
- Update **yaml-ast-parser** to [0.0.34](https://github.com/mulesoft-labs/yaml-ast-parser/releases/tag/0.0.34).
- Some parsing warnings will now correctly display as warnings instead of errors.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Schemas are handled exactly [same way they are with JSON in Visual Studio Code](

## Known Issues
- No support has been implemented for include references. ([relevant code](https://github.com/adamvoss/vscode-yaml-languageservice/blob/9199669d241f8fb5fde801399c4cd5abd0bc6d52/src/parser/yamlParser.ts#L243-L247))
- Only one document is supported per file.
- Color decorators (`yaml.colorDecorators.enable`) do not work even when enabled.

## Acknowledgments
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "yaml",
"displayName": "YAML",
"description": "YAML for Visual Studio Code",
"version": "0.0.6",
"version": "0.0.7",
"publisher": "adamvoss",
"license": "MIT",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions server/src/yamlServerMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import fs = require('fs');
import URI from './utils/uri';
import * as URL from 'url';
import Strings = require('./utils/strings');
import { JSONDocument, JSONSchema, LanguageSettings, getLanguageService } from 'vscode-yaml-languageservice';
import { YAMLDocument, JSONSchema, LanguageSettings, getLanguageService } from 'vscode-yaml-languageservice';
import { getLanguageModelCache } from './languageModelCache';

import * as nls from 'vscode-nls';
Expand Down Expand Up @@ -279,15 +279,15 @@ connection.onDidChangeWatchedFiles((change) => {
}
});

let yamlDocuments = getLanguageModelCache<JSONDocument>(10, 60, document => languageService.parseJSONDocument(document));
let yamlDocuments = getLanguageModelCache<YAMLDocument>(10, 60, document => languageService.parseYAMLDocument(document));
documents.onDidClose(e => {
yamlDocuments.onDocumentRemoved(e.document);
});
connection.onShutdown(() => {
yamlDocuments.dispose();
});

function getJSONDocument(document: TextDocument): JSONDocument {
function getJSONDocument(document: TextDocument): YAMLDocument {
return yamlDocuments.get(document);
}

Expand Down

0 comments on commit 788fc62

Please sign in to comment.