From 93c4dc2a58d589ee8b90e3191754010ba99a6ceb Mon Sep 17 00:00:00 2001 From: Sam Roeca Date: Fri, 8 May 2020 09:50:51 -0400 Subject: [PATCH] Attribute access on InitializeParams uses rgetattr --- CHANGELOG.md | 6 ++++++ jedi_language_server/server.py | 6 ++++-- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b570a11..5155e8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/jedi_language_server/server.py b/jedi_language_server/server.py index 2e2a351..848ea65 100644 --- a/jedi_language_server/server.py +++ b/jedi_language_server/server.py @@ -65,7 +65,9 @@ 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", @@ -73,7 +75,7 @@ def bf_initialize(self, params: InitializeParams) -> InitializeResult: 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) diff --git a/pyproject.toml b/pyproject.toml index 9c82b9f..b6c5e3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] readme = "README.md"