PT #135782951: (Part 1) Completions for deprecated properties

This commit is contained in:
BoykoAlex
2019-01-09 19:13:59 -05:00
parent 82eb40b633
commit 6a9e40dbbb
9 changed files with 122 additions and 176 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016-2018 Pivotal, Inc.
* Copyright (c) 2016, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,4 +40,6 @@ public interface ICompletionProposal {
default InsertTextFormat getInsertTextFormat() { return InsertTextFormat.Snippet; }
default boolean isDeprecated() { return false; }
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2018 Pivotal, Inc.
* Copyright (c) 2016, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -178,6 +178,9 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
item.setSortText(sortkeys.next());
item.setFilterText(completion.getFilterText());
item.setDetail(completion.getDetail());
if (completion.isDeprecated()) {
item.setDeprecated(completion.isDeprecated());
}
resolveEdits(doc, completion, item); //Warning. Its not allowed by LSP spec to resolveEdits
//lazy as we used to do in the past.
if (resolver!=null) {

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016-2018 Pivotal, Inc.
* Copyright (c) 2016, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -668,6 +668,18 @@ public class Editor {
return it;
}
public CompletionItem assertCompletionDetailsWithDeprecation(String expectLabel, String expectDetail, String expectDocSnippet, Boolean deprecated) throws Exception {
CompletionItem it = harness.resolveCompletionItem(assertCompletionWithLabel(expectLabel));
if (expectDetail!=null) {
assertEquals(expectDetail, it.getDetail());
}
if (expectDocSnippet!=null) {
assertContains(expectDocSnippet, getDocString(it));
}
assertEquals(deprecated, it.getDeprecated());
return it;
}
protected CompletionItem assertCompletionWithLabel(Predicate<String> expectLabel) throws Exception {
List<CompletionItem> completions = getCompletions();
Optional<CompletionItem> completion = completions.stream()