Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Fix invalid insertTextFormat in CompletionItem instances #344

Merged
merged 3 commits into from
Nov 5, 2018

Conversation

jakebailey
Copy link
Member

Fixes #342.

All places where insertText is set, insertTextFormat is now also set. Tests which check insertText directly also now check insertTextFormat. Most tests use AssertCompletion, which I have modified to also check that every matching completion has a specific format. VS complains about the tuple because I used Item# instead of an inferred name to access it, which I'd like to do but cannot because this project seems to only be on C# 7.0, not 7.1.

I think it would be better for the classes that use these sorts of enums to explicitly define the default value (especially given so many LSP enums do not contain 0), but there are quite a few enums and a load of duplication in the two Structures.cs files that I'm not going to try to attempt it now.

@@ -146,6 +146,7 @@ await InvokeExtensionsAsync((ext, token)
filterText = x.filterText,
preselect = x.preselect,
insertText = x.insertText,
insertTextFormat = (PythonTools.Analysis.LanguageServer.InsertTextFormat)x.insertTextFormat,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using? Definitions that are in the engine are obsolete and are kept around for backward compat. POR to remove them in a month or so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if any of that is used, but I wanted to be thorough and make sure it's set anywhere it can be. Once all of the old types go away this'll probably also be deleted (and we can probably start setting sane defaults too).

@jakebailey jakebailey merged commit 56060c3 into microsoft:master Nov 5, 2018
@jakebailey jakebailey deleted the insert-text-format branch February 14, 2019 20:12
jakebailey added a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
* fix invalid insertTextFormat in CompletionItem instances

* check insertTextFormat in AssertCompletion, defaulted to PlainText

* only check items which are in contains for format matching, not all
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants