@ansible/ansible-language-server
Advanced tools
Comparing version 0.2.2-beta to 0.2.3-beta
@@ -9,5 +9,8 @@ # Change Log | ||
## [0.1.0-1] - 2021-07-28 | ||
- Update npm package to include out folder | ||
- | ||
## [0.1.0] - 2021-07-28 | ||
- Initial ansible language server release. Based on the vscode-ansible plugin developed by [Tomasz Maciążek](https://github.com/tomaciazek) | ||
- Initial ansible language server release. Based on the vscode-ansible plugin | ||
developed by [Tomasz Maciążek](https://github.com/tomaciazek) |
@@ -35,3 +35,8 @@ "use strict"; | ||
); | ||
this._collection_paths = parsePythonStringArray(config.COLLECTIONS_PATHS); | ||
if (typeof config.COLLECTIONS_PATHS === 'string') { | ||
parsePythonStringArray(config.COLLECTIONS_PATHS); | ||
} | ||
else { | ||
this._collection_paths = []; | ||
} | ||
// get Ansible basic information | ||
@@ -75,7 +80,7 @@ const ansibleVersionResult = yield commandRunner.runCommand('ansible', '--version'); | ||
exports.AnsibleConfig = AnsibleConfig; | ||
function parsePythonStringArray(array) { | ||
array = array.slice(1, array.length - 1); // remove [] | ||
const quoted_elements = array.split(',').map((e) => e.trim()); | ||
function parsePythonStringArray(string_list) { | ||
const cleaned_str = string_list.slice(1, string_list.length - 1); // remove [] | ||
const quoted_elements = cleaned_str.split(',').map((e) => e.trim()); | ||
return quoted_elements.map((e) => e.slice(1, e.length - 1)); | ||
} | ||
//# sourceMappingURL=ansibleConfig.js.map |
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.2-beta", | ||
"version": "0.2.3-beta", | ||
"contributors": [ | ||
@@ -10,0 +10,0 @@ { |
115
README.md
# Ansible Language Server | ||
This language server adds support for Ansible and is currently used by the | ||
@@ -8,7 +9,7 @@ following projects: | ||
### Getting started | ||
## Getting started | ||
1. Install prerequisites: | ||
- latest [Visual Studio Code](https://code.visualstudio.com/) | ||
- [Node.js](https://nodejs.org/) v12.0.0 or higher | ||
* latest [Visual Studio Code](https://code.visualstudio.com/) | ||
* [Node.js](https://nodejs.org/) v12.0.0 or higher | ||
@@ -18,13 +19,16 @@ 2. Fork and clone this repository | ||
3. Install the dependencies | ||
```bash | ||
cd ansible-language-server | ||
$ npm ci | ||
npm ci | ||
``` | ||
4. Build the language server | ||
```bash | ||
$ npm run compile | ||
npm run compile | ||
``` | ||
5. The new built server is now located in ./out/server/src/server.js. | ||
5. The newly built server is now located in ./out/server/src/server.js. | ||
```bash | ||
@@ -37,2 +41,3 @@ node <Ansible Language Server Location>/out/server/src/server.js --stdio | ||
### Syntax highlighting | ||
![Syntax highlighting](images/syntax-highlighting.png) | ||
@@ -48,11 +53,14 @@ | ||
> the One Dark Pro theme. The default VS Code theme will not show the syntax | ||
> elements as distinctly, unless customized. Virtually any theme other than | ||
> elements as distinctly unless customized. Virtually any theme other than | ||
> default will do better. | ||
### Validation | ||
![YAML validation](images/yaml-validation.gif) | ||
While you type, the syntax of your Ansible scripts is verified and any feedback is provided instantaneously. | ||
While you type, the syntax of your Ansible scripts is verified and any feedback | ||
is provided instantaneously. | ||
#### Integration with ansible-lint | ||
![Linter support](images/ansible-lint.gif) | ||
@@ -70,3 +78,9 @@ | ||
***Note*** | ||
If `ansible-lint` is not installed/found or running `ansible-lint` results in | ||
error it will fallback to `ansible --syntax-check` for validation. | ||
### Smart autocompletion | ||
![Autocompletion](images/smart-completions.gif) | ||
@@ -77,5 +91,7 @@ | ||
improve user experience: | ||
- the `name` property is always suggested first | ||
- on module options, the required properties are shown first, and aliases are shown last, otherwise ordering from the documentation is preserved | ||
- FQCNs (fully qualified collection names) are inserted only when necessary; | ||
* the `name` property is always suggested first | ||
* on module options, the required properties are shown first, and aliases are | ||
shown last, otherwise ordering from the documentation is preserved | ||
* FQCNs (fully qualified collection names) are inserted only when necessary; | ||
collections configured with the | ||
@@ -86,9 +102,12 @@ [`collections` keyword]([LINK](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#simplifying-module-names-with-the-collections-keyword)) | ||
#### Auto-closing Jinja expressions | ||
![Easier Jinja expression typing](images/jinja-expression.gif) | ||
When writing a Jinja expression, you only need to type `"{{ `, and it will be | ||
mirrored behind the cursor (including the space). You can also select the whole | ||
expression and press `space` to put spaces on both sides of the expression. | ||
When writing a Jinja expression, you only need to type `"{{<space>`, and it | ||
will be mirrored behind the cursor (including the space). You can also select | ||
the whole expression and press `space` to put spaces on both sides of the | ||
expression. | ||
### Documentation reference | ||
![Documentation on hover](images/hover-documentation-module.png) | ||
@@ -101,2 +120,3 @@ | ||
#### Jump to module code | ||
![Go to code on Ctrl+click](images/go-to-definition.gif) | ||
@@ -108,40 +128,59 @@ | ||
## Requirements | ||
- [Ansible 2.9+](https://docs.ansible.com/ansible/latest/index.html) | ||
- [Ansible Lint](https://ansible-lint.readthedocs.io/en/latest/) (required, | ||
unless you disable linter support) | ||
- [yamllint](https://yamllint.readthedocs.io/en/stable/) (optional) | ||
## Language Server Settings | ||
For Windows users, this extension works perfectly well with extensions such as | ||
`Remote - WSL` and `Remote - Containers`. | ||
The following settings are supported. | ||
> If you have any other extension providing language support for Ansible, you might need to uninstall it first. | ||
## Configuration | ||
This extension supports multi-root workspaces, and as such, can be configured on | ||
any level (User, Remote, Workspace and/or Folder). | ||
- `ansible.ansible.path`: Path to the `ansible` executable. | ||
- `ansible.ansible.useFullyQualifiedCollectionNames`: Toggles use of | ||
* `ansible.ansible.path`: Path to the `ansible` executable. | ||
* `ansible.ansible.useFullyQualifiedCollectionNames`: Toggles use of | ||
fully qualified collection names (FQCN) when inserting a module name. | ||
Disabling it will only use FQCNs when necessary, that is when the collection | ||
isn't configured for the task. | ||
- `ansible.ansibleLint.enabled`: Enables/disables use of `ansible-lint`. | ||
- `ansible.ansibleLint.path`: Path to the `ansible-lint` executable. | ||
- `ansible.ansibleLint.arguments`: Optional command line arguments to be | ||
* `ansible.ansibleLint.arguments`: Optional command line arguments to be | ||
appended to `ansible-lint` invocation. See `ansible-lint` documentation. | ||
- `ansible.python.interpreterPath`: Path to the `python`/`python3` executable. | ||
* `ansible.ansibleLint.enabled`: Enables/disables use of `ansible-lint`. | ||
* `ansible.ansibleLint.path`: Path to the `ansible-lint` executable. | ||
* `ansible.ansibleNavigator.path`: Path to the `ansible-navigator` executable. | ||
* `ansible.ansiblePlaybook.path`: Path to the `ansible-playbook` executable. | ||
* `ansible.executionEnvironment.containerEngine`: The container engine to be used | ||
while running with execution environment. Valid values are `auto`, `podman` and | ||
`docker`. For `auto` it will look for `podman` then `docker`. | ||
* `ansible.executionEnvironment.enabled`: Enable or disable the use of an | ||
execution environment. | ||
* `ansible.executionEnvironment.image`: Specify the name of the execution | ||
environment image. | ||
* `ansible.executionEnvironment.pullPolicy`: Specify the image pull policy. | ||
Valid values are `always`, | ||
`missing`, `never` and `tag`. Setting `always` will always pull the image | ||
when extension is activated or reloaded. | ||
Setting `missing` will pull if not locally available. Setting `never` will | ||
never pull the image and setting tag will always pull if the image tag is | ||
'latest', otherwise pull if not locally available. | ||
* `ansible.python.interpreterPath`: Path to the `python`/`python3` executable. | ||
This setting may be used to make the extension work with `ansible` and | ||
`ansible-lint` installations in a Python virtual environment. | ||
- `ansible.python.activationScript`: Path to a custom `activate` script, which | ||
* `ansible.python.activationScript`: Path to a custom `activate` script, which | ||
will be used instead of the setting above to run in a Python virtual | ||
environment. | ||
## Requirements | ||
* [Ansible 2.9+](https://docs.ansible.com/ansible/latest/index.html) | ||
* [Ansible Lint](https://ansible-lint.readthedocs.io/en/latest/) (required, | ||
unless you disable linter support) | ||
* [yamllint](https://yamllint.readthedocs.io/en/stable/) (optional) | ||
For Windows users, this extension works perfectly well with extensions such as | ||
`Remote - WSL` and `Remote - Containers`. | ||
> If you have any other extension providing language support for Ansible, you | ||
might need to uninstall it first. | ||
## Known limitations | ||
- The shorthand syntax for module options (key=value pairs) is not supported. | ||
- Nested module options are not supported yet. | ||
- Only Jinja *expressions* inside Ansible YAML files are supported. In order to | ||
* The shorthand syntax for module options (key=value pairs) is not supported. | ||
* Nested module options are not supported yet. | ||
* Only Jinja *expressions* inside Ansible YAML files are supported. In order to | ||
have syntax highlighting of Jinja template files, you'll need to install other | ||
extension. | ||
- Jinja *blocks* (inside Ansible YAML files) are not supported yet. | ||
* Jinja *blocks* (inside Ansible YAML files) are not supported yet. | ||
@@ -148,0 +187,0 @@ ## Credit |
# TextMate grammar authoring | ||
TextMate grammars (which VS Code uses for syntax highlighting) are authored in a | ||
@@ -3,0 +4,0 @@ [textual property-list format](https://macromates.com/manual/en/language_grammars). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
517647
4862
181