microsoft / microsoft/language-server-protocol

When are params and error data optional?

Open
#1,883 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarification
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

The JSON-RPC spec says that the params field of a request or notification is optional; and similarly for the data field on a response error.

However, in many cases omitting params is nonsensical: the user can't ask for a hover without telling us where! And conversely, in the few cases where params aren't necessary, they must be omitted (because there isn't even a param type!).

So the approach we have been taking in HLS is:

  • If the metamodel specifies a parameter type for a method, then params must be present
  • If the metamodel does not specify a parameter type, then params must be absent

Is this right? If so, could we say as much in the spec?

There is a similar question for error data: when it is specified in the metamodel that a method has an error data type, does that mean that any errors for that method must include error data, or is it still optional?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is identified. Start by reviewing the JSON-RPC and LSP specification sections covering request params and error data; done means the specification explicitly resolves when each field is required, optional, or forbidden.

Written by the indexing model from the issue text.

Assessment

Domain
api, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.