Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/completion/CompletionEngine.java

Issue 86413003: Issue 10693. Fix for displaying constructor documentation in code completion. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 } 2146 }
2147 2147
2148 private CompletionProposal createProposal(Element element) { 2148 private CompletionProposal createProposal(Element element) {
2149 String completion = element.getDisplayName(); 2149 String completion = element.getDisplayName();
2150 return createProposal(element, completion); 2150 return createProposal(element, completion);
2151 } 2151 }
2152 2152
2153 private CompletionProposal createProposal(Element element, String completion) { 2153 private CompletionProposal createProposal(Element element, String completion) {
2154 ProposalKind kind = proposalKindOf(element); 2154 ProposalKind kind = proposalKindOf(element);
2155 CompletionProposal prop = createProposal(kind); 2155 CompletionProposal prop = createProposal(kind);
2156 prop.setElement(element);
2156 prop.setCompletion(completion); 2157 prop.setCompletion(completion);
2157 prop.setDeprecated(isDeprecated(element)); 2158 prop.setDeprecated(isDeprecated(element));
2158 if (isPrivate(element)) { 2159 if (isPrivate(element)) {
2159 prop.setRelevance(0); 2160 prop.setRelevance(0);
2160 } 2161 }
2161 return prop; 2162 return prop;
2162 } 2163 }
2163 2164
2164 private CompletionProposal createProposal(ProposalKind kind) { 2165 private CompletionProposal createProposal(ProposalKind kind) {
2165 return factory.createCompletionProposal(kind, completionLocation() - filter. prefix.length()); 2166 return factory.createCompletionProposal(kind, completionLocation() - filter. prefix.length());
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 2415
2415 CompletionProposal prop = createProposal(element); 2416 CompletionProposal prop = createProposal(element);
2416 2417
2417 prop.setPotentialMatch(isPotentialMatch); 2418 prop.setPotentialMatch(isPotentialMatch);
2418 if (isPotentialMatch) { 2419 if (isPotentialMatch) {
2419 prop.setRelevance(0); 2420 prop.setRelevance(0);
2420 } 2421 }
2421 2422
2422 setParameterInfo(element, prop); 2423 setParameterInfo(element, prop);
2423 prop.setCompletion(name).setReturnType(element.getType().getReturnType().get DisplayName()); 2424 prop.setCompletion(name).setReturnType(element.getType().getReturnType().get DisplayName());
2424 prop.setElement(element);
2425 2425
2426 // If there is already argument list, then update only method name. 2426 // If there is already argument list, then update only method name.
2427 if (identifier.getParent() instanceof MethodInvocation 2427 if (identifier.getParent() instanceof MethodInvocation
2428 && ((MethodInvocation) identifier.getParent()).getArgumentList() != null ) { 2428 && ((MethodInvocation) identifier.getParent()).getArgumentList() != null ) {
2429 prop.setKind(ProposalKind.METHOD_NAME); 2429 prop.setKind(ProposalKind.METHOD_NAME);
2430 } 2430 }
2431 2431
2432 Element container = element.getEnclosingElement(); 2432 Element container = element.getEnclosingElement();
2433 if (container != null) { 2433 if (container != null) {
2434 prop.setDeclaringType(container.getDisplayName()); 2434 prop.setDeclaringType(container.getDisplayName());
2435 } 2435 }
2436 2436
2437 requestor.accept(prop); 2437 requestor.accept(prop);
2438 } 2438 }
2439 2439
2440 private void pExecutable(VariableElement element, SimpleIdentifier identifier) { 2440 private void pExecutable(VariableElement element, SimpleIdentifier identifier) {
2441 // Create a completion proposal for the element: top-level variable. 2441 // Create a completion proposal for the element: top-level variable.
2442 String name = element.getDisplayName(); 2442 String name = element.getDisplayName();
2443 if (name.isEmpty() || filterDisallows(element)) { 2443 if (name.isEmpty() || filterDisallows(element)) {
2444 return; // Simple constructors are not handled here 2444 return; // Simple constructors are not handled here
2445 } 2445 }
2446 CompletionProposal prop = createProposal(element); 2446 CompletionProposal prop = createProposal(element);
2447 prop.setElement(element);
2448 if (element.getType() != null) { 2447 if (element.getType() != null) {
2449 prop.setReturnType(element.getType().getName()); 2448 prop.setReturnType(element.getType().getName());
2450 } 2449 }
2451 Element container = element.getEnclosingElement(); 2450 Element container = element.getEnclosingElement();
2452 if (container != null) { 2451 if (container != null) {
2453 prop.setDeclaringType(container.getDisplayName()); 2452 prop.setDeclaringType(container.getDisplayName());
2454 } 2453 }
2455 if (identifier != null) { 2454 if (identifier != null) {
2456 prop.setReplacementLengthIdentifier(identifier.getLength()); 2455 prop.setReplacementLengthIdentifier(identifier.getLength());
2457 } 2456 }
2458 requestor.accept(prop); 2457 requestor.accept(prop);
2459 } 2458 }
2460 2459
2461 private void pFalse() { 2460 private void pFalse() {
2462 pWord(C_FALSE, ProposalKind.VARIABLE); 2461 pWord(C_FALSE, ProposalKind.VARIABLE);
2463 } 2462 }
2464 2463
2465 private void pField(FieldElement element, SimpleIdentifier identifier, ClassEl ement classElement) { 2464 private void pField(FieldElement element, SimpleIdentifier identifier, ClassEl ement classElement) {
2466 // Create a completion proposal for the element: field only. 2465 // Create a completion proposal for the element: field only.
2467 if (filterDisallows(element)) { 2466 if (filterDisallows(element)) {
2468 return; 2467 return;
2469 } 2468 }
2470 CompletionProposal prop = createProposal(element); 2469 CompletionProposal prop = createProposal(element);
2471 prop.setElement(element);
2472 Element container = element.getEnclosingElement(); 2470 Element container = element.getEnclosingElement();
2473 prop.setDeclaringType(container.getDisplayName()); 2471 prop.setDeclaringType(container.getDisplayName());
2474 requestor.accept(prop); 2472 requestor.accept(prop);
2475 } 2473 }
2476 2474
2477 private void pKeyword(Token keyword) { 2475 private void pKeyword(Token keyword) {
2478 // This isn't as useful as it might seem. It only works in the case that com pletion 2476 // This isn't as useful as it might seem. It only works in the case that com pletion
2479 // is requested on an existing recognizable keyword. 2477 // is requested on an existing recognizable keyword.
2480 CompletionProposal prop = factory.createCompletionProposal( // TODO: Add key word proposal kind 2478 CompletionProposal prop = factory.createCompletionProposal( // TODO: Add key word proposal kind
2481 ProposalKind.LIBRARY_PREFIX, 2479 ProposalKind.LIBRARY_PREFIX,
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 return null; 2844 return null;
2847 } 2845 }
2848 Iterator<Type> iter = matches.iterator(); 2846 Iterator<Type> iter = matches.iterator();
2849 Type result = iter.next(); 2847 Type result = iter.next();
2850 while (iter.hasNext()) { 2848 while (iter.hasNext()) {
2851 result = result.getLeastUpperBound(iter.next()); 2849 result = result.getLeastUpperBound(iter.next());
2852 } 2850 }
2853 return result; 2851 return result;
2854 } 2852 }
2855 } 2853 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698