Skip to content

Commit

Permalink
Attribute access on InitializeParams uses rgetattr
Browse files Browse the repository at this point in the history
  • Loading branch information
pappasam committed May 8, 2020
1 parent 206c42c commit 93c4dc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.13.1

### Changed

- Attribute access on InitializeParams now exclusively uses `rgetattr` in case Language Client omits optional fields in request.

## 0.13.0

### Changed
Expand Down
6 changes: 4 additions & 2 deletions jedi_language_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ def bf_initialize(self, params: InitializeParams) -> InitializeResult:
client capabilities and initializationOptions.
"""
server: "LanguageServer" = self._server
text_document_capabilities = params.capabilities.textDocument
text_document_capabilities = rgetattr(
params, "capabilities.textDocument"
)
if rgetattr(
text_document_capabilities,
"documentSymbol.hierarchicalDocumentSymbolSupport",
):
server.feature(DOCUMENT_SYMBOL)(document_symbol)
else:
server.feature(DOCUMENT_SYMBOL)(document_symbol_legacy)
init = params.initializationOptions
init = rgetattr(params, "initializationOptions")
if rgetattr(init, "diagnostics.enable", True):
if rgetattr(init, "diagnostics.didOpen", True):
SERVER.feature(TEXT_DOCUMENT_DID_OPEN)(did_open)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include_trailing_comma = true

[tool.poetry]
name = "jedi-language-server"
version = "0.13.0"
version = "0.13.1"
description = "A language server for Jedi!"
authors = ["Sam Roeca <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 93c4dc2

Please sign in to comment.