The latest Cloud Code update introduces a pivotal feature you need to know about: integrated Language Server Protocol (LSP) support. This is a game-changer. It allows Cloud Code to communicate directly with the programming language you’re using, mirroring the sophisticated workflow professional developers have relied on for years in their code editors. Now, you can achieve that same level of efficiency and accuracy directly within Cloud Code.
Let’s see how it works.
The Old Way vs. The New Way
Imagine you’re in an AI-powered application and you want to locate the code responsible for invoking a language model. Without LSP, you might ask Cloud Code:
“Find the code that’s used to invocate an LLM.”
Cloud Code would use its standard search tools. It would scan for text related to “chat” and “completions” or look for “OpenAI” references. It might find the correct line, like an LLM call in a backend file. This works, but it’s not precise. It’s just text search.
The real power of LSP shines when you ask more complex questions. Questions that require a true understanding of the code’s structure.
Finding Code References with Precision
Consider this prompt:
“Find all the references in the codebase where this function is used.”
This kind of query is incredibly effective for understanding how code is interconnected and for safely fixing bugs introduced by AI-generated code. However, without the proper setup, you might encounter an issue. When you ask Cloud Code to perform this search “with LSP,” it might respond:
“No LSP server is available for Python. Will use grep instead.”
The problem with grep is its limitation. It’s a powerful text-search utility, but it lacks the contextual awareness of a language server. An LSP is purpose-built to find code references quickly and accurately within the specific language you’re programming in.
Setting Up Your Language Server
Fortunately, configuring the LSP server is remarkably simple.
- Type the
/plugincommand in Cloud Code. - Browse the available plugins until you find the one for your language.
For Python developers, the plugin to look for is Pyrite LSP. You can install it with a single click. Most standard languages are supported out of the box. If you’re working with a more obscure language, documentation is available to help you add a custom LSP server.
Once installed, you can verify it by typing /plugin again. You should see that Pyrite LSP, Microsoft’s static analyzer for Python, is now active.
Note: At the time of writing, this feature might be unstable in the latest version of Cloud Code. If you encounter issues, you may need to switch to a specific, more stable version. A quick restart of Cloud Code after installation is also recommended.
LSP in Action: A Practical Example
With the LSP server running, let’s try our reference-finding query again.
“Find the function for LLM invocation in this file and use LSP to find all references across the project.”
This is where the magic happens. Cloud Code will no longer naively read hundreds of files or rely on basic command-line tools. Instead, it leverages the language server to find all references to the function. This is vastly more efficient, especially in large codebases.
The LSP might quickly return three references across two files. For instance:
backend/app.pyon line 108, whereinvoke_language_model()is called.backend/transcription.pyon line 56, where the function is defined.backend/transcription.pyon line 90, where the function calls itself within the same class.
This allows Cloud Code to operate much more like a human developer. If you want to know where a function is defined, you don’t search through files manually. You use a shortcut, like Ctrl+Click, to jump straight to the definition. Cloud Code can now use these same intelligent shortcuts.
The technology powering this is mature and robust. The popular Serena MCP server, with over 17,000 stars on GitHub, has been exposing language servers to AI code editors for some time. It has been battle-tested on large, complex projects, not just the simple demos you often see. The great news is that you no longer need to set up a complex MCP server yourself; it’s all easily configured within Cloud Code via a simple plugin.
Understanding Code on a Deeper Level
Here’s another powerful question to ask your LSP-enabled Cloud Code:
“What parameters does the
ChatCompletion.createmethod accept?”
In a dynamically typed language like Python, AI code generators can often make mistakes with function arguments. But with LSP, Cloud Code can query the language server to understand precisely what parameters a function requires.
It will return a detailed list, including:
- Required Parameters:
model,messages - Optional Parameters:
frequency_penalty,logit_bias,max_tokens,n,presence_penalty, and many more.
It won’t just give you the names; it will provide descriptions for each parameter. How does it do this? It’s doing exactly what a professional developer would do. By hovering over the create method in a code editor, a developer can see a tooltip with all this information.
# Example of a function call LSP can analyze
import openai
def get_ai_summary(text_to_summarize):
"""
Generates a summary using OpenAI's ChatCompletion.
"""
try:
response = openai.ChatCompletion.create(
model="gpt-4-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant that summarizes text."},
{"role": "user", "content": text_to_summarize}
],
temperature=0.5,
max_tokens=150
)
return response.choices[0].message.content
except Exception as e:
print(f"An error occurred: {e}")
return None
Cloud Code now has this same “hover” capability. It can read extensive information about function definitions and use that knowledge to generate safer, more reliable code, or pass that information directly back to you. This is a monumental step forward for writing functional, working code with AI.