LookML Language Server (beta)
This is a language server for LookML. It is used to provide autocompletion, linting, and other features for LookML files. While in its beta state we are actively working in the following areas:
- 1:1 parity with the LookML IDE
- Tools to sync and communicate with your development mode in Looker
- Enhancements to live LookML validation
We are actively looking for feedback and contributions from the community, please file issues.
There are a few steps you need to follow to get the Language Server working.
- If this if the first time you're using the Language Server, you'll need to register a new OAuth client to communicate with the Language Server go
- If you've already registered an OAuth client, you can skip that step and go to looker-login
- Make sure you do not have uncommited changes in your LookML development mode
- After you've opened up a LookML repository in your IDE, run the looker-sync-branches command to ensure your local LookML files are on the development branch and up to date
- Make some LookML Changes and run the looker-save-all-stage-all-commit-and-sync (hotkey
alt+shift+r
) to push your changes to Looker
Setting up your Looker Environment
The LookML Language Server uses OAuth2 to authenticate to Looker and manages the authentication lifecycle for you. A Looker Admin will need to Register a new OAuth client to communicate with the Language Server:
- Go to the Looker API Explorer for Register OAuth App (https://your.looker.instance/extensions/marketplace_extension_api_explorer::api-explorer/4.0/methods/Auth/register_oauth_client_app)
- Enter
lkr-cli
as the client_id
- Enter the following payload in the body
{
"redirect_uri": "http://localhost:8000/callback",
"display_name": "LKR",
"description": "lkr.dev language server, MCP and CLI",
"enabled": true
}
- Check the "I Understand" box and click the Run button
This only needs to be done once per instance.
Commands
Looker: Login
The Looker: Login command provides the following functionality:
- Navigate to a *.lookml file
- Open the command palette
- Search for "Looker: Login"
- Add new Looker instance
- Choose between development or production mode. We recommend the development option for Language Server to use.
- Name your instance
- Your browser will open to the Looker OAuth page for the LKR client installed above
- Authorize the app, and close the redirected window
You may login to multiple instances, but only one is active at a time. Use Looker: Login to switch between instances and development/production modes.
Looker: Sync Branches
The Looker: Sync Branches command ensures your local Looker project is on the development branch and up to date. When you run this command:
- The extension checks for the current Looker project name. If it is not set, you are prompted to enter it.
- It retrieves the name of the development branch and the currently checked-out branch for the project.
- If you are not already on the development branch, the extension automatically switches to the development branch and pulls the latest changes from the remote repository.
This helps keep your local LookML files in sync with the main development branch in Looker, reducing merge conflicts and ensuring you are working with the latest code.
Looker: Select Project
The Looker: Select Project command allows you to set the current Looker project name. This is used when we're communicating with the Looker API to make sure we're hitting the correct project with the API calls When you run this command:
- The extension prompts you to enter the name of your Looker project.
- You can enter the project name directly or select it from a list of projects you have previously configured.
Looker: Reset to Remote
The Looker: Reset to Remote command allows you to reset your local Looker project to the remote branch. When you run this command:
- The extension prompts you to enter the name of your Looker project.
- You can enter the project name directly or select it from a list of projects you have previously configured.
Looker: Save All, Stage All, Commit, and Sync
The Looker: Save All, Stage All, Commit, and Sync command allows you to save all files, stage all changes, commit all changes, and have Looker automatically sync with the remote branch. When you run this command:
- The extension prompts you to enter the name of your Looker project if not provided.
- The command will save all files
- Stage all changes
- Commit all changes with autogenerated commit message or your own commit message
- Have Looker automatically sync with the remote branch
This is a quick way to save all changes, commit them, and have Looker automatically sync with the remote branch. The extension also has a hotkey of alt+shift+r
to run this command and can be customized in your editor settings by overriding adding the following to your keybindings.json
file:
{
"key": "alt+shift+r",
"command": "looker.saveAllStageAllCommitAndSync",
"when": "editorTextFocus"
}