A demo of the setup can be found on youtube.
It is recommended to work on the forked copy of this repository from your github account to raise pull requests.
git clone [email protected]:<your-github-id>/ansible-language-server.git
cd ansible-language-server
git remote add upstream [email protected]:ansible/ansible-language-server.git
git fetch --all
git checkout -b <name_of_branch> upstream/main
- Install dependent packages within ansible-language-server root directory
ansible-language-server$ npm install .
This will install the dependent modules under node_modules
folder within the
current directory.
- Clone the repository containing the VS Code extension code into the
vscode-ansible
directory next to the root directory of this repository.
cd ..
git clone [email protected]:ansible/vscode-ansible.git
cd vscode-ansible
-
Open a new VS Code window and add folder to workspace
File -> Add folder to workspace
and addvscode-ansible
andansible-language-server
folders to the workspace -
Once the language server and
vscode-ansible/
directory is prepared, compile both client and server using command
npm run compile-withserver
-
In the Run and debug window select Client + Server (source) configuration and start debugging
Run -> Start Debugging
. This will open up a new VS Code window which is theExtension development Host
window. -
In the
Extension development Host
window add a new folder that has ansible files. -
You can set the ansible-language-server settings by adding
.vscode/settings.json
file under the root folder. Example settings:
{
"ansible.python.interpreterPath": "<change to python3 executable path>",
"ansible.ansible.path": "<change to ansible executable path>",
"ansibleServer.trace.server": "verbose"
}
If you hit an odd compilation or debugger problem, don't hesitate to clean the
output directory by running npm run clean
under the vscode-ansible
folder.
You should also run it whenever you are switching between debug/compilation
modes.
-
Install prerequisites:
- latest Visual Studio Code
- Node.js v12.0.0 or higher
-
Fork and clone this repository
-
Install the dependencies
cd ansible-language-server npm ci
-
Build the language server
npm run compile
-
The newly built server is now located in
./out/server/src/server.js
.node ./out/server/src/server.js --stdio