some code cleanup work

This commit is contained in:
Martin Lippert
2017-03-10 14:23:50 +01:00
parent f53370e380
commit 88ab57f1a0
5 changed files with 11 additions and 92 deletions

View File

@@ -14,7 +14,6 @@ import org.eclipse.lsp4j.CompletionItemKind;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.text.IDocument;
/**
* @author Martin Lippert

View File

@@ -24,10 +24,8 @@ import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.ReferenceParams;
import org.springframework.ide.vscode.boot.java.hover.ValueHoverProvider;
import org.springframework.ide.vscode.commons.java.IClasspath;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;

View File

@@ -130,11 +130,16 @@ public class ValuePropertyReferencesProvider {
return findReferencesInPropertiesFile(filePath, propertyKey);
}
else if (filePath.endsWith(".yml")) {
// do the real work
return findReferencesInYMLFile(filePath, propertyKey);
}
return new ArrayList<Location>();
}
private List<Location> findReferencesInYMLFile(String filePath, String propertyKey) {
List<Location> foundLocations = new ArrayList<>();
return foundLocations;
}
private List<Location> findReferencesInPropertiesFile(String filePath, String propertyKey) {
List<Location> foundLocations = new ArrayList<>();

View File

@@ -30,97 +30,9 @@ public class SpringPropertyIndex extends FuzzyMap<ConfigurationMetadataProperty>
}
}
/**
* Dumps out 'test data' based on the current contents of the index. This is not meant to be
* used in 'production' code. The idea is to call this method during development to dump a
* 'snapshot' of the index onto System.out. The data is printed in a forma so that it can be easily
* pasted/used into JUNit testing code.
*/
// public void dumpAsTestData() {
// List<Match<PropertyInfo>> allData = this.find("");
// for (Match<PropertyInfo> match : allData) {
// PropertyInfo d = match.data;
// System.out.println("data("
// +dumpString(d.getId())+", "
// +dumpString(d.getType())+", "
// +dumpString(d.getDefaultValue())+", "
// +dumpString(d.getDescription()) +");"
// );
// for (PropertySource source : d.getSources()) {
// String st = source.getSourceType();
// String sm = source.getSourceMethod();
// if (sm!=null) {
// System.out.println(d.getId() +" from: "+st+"::"+sm);
// }
// }
// }
// }
// private String dumpString(Object v) {
// if (v==null) {
// return "null";
// }
// return dumpString(""+v);
// }
private String dumpString(String s) {
if (s==null) {
return "null";
} else {
StringBuilder buf = new StringBuilder("\"");
for (char c : s.toCharArray()) {
switch (c) {
case '\r':
buf.append("\\r");
break;
case '\n':
buf.append("\\n");
break;
case '\\':
buf.append("\\\\");
break;
case '\"':
buf.append("\\\"");
break;
default:
buf.append(c);
break;
}
}
buf.append("\"");
return buf.toString();
}
}
@Override
protected String getKey(ConfigurationMetadataProperty entry) {
return entry.getId();
}
/**
* Find the longest known property that is a prefix of the given name. Here prefix does not mean
* 'string prefix' but a prefix in the sense of treating '.' as a kind of separators. So
* 'prefix' is not allowed to end in the middle of a 'segment'.
*/
// public static PropertyInfo findLongestValidProperty(FuzzyMap<PropertyInfo> index, String name) {
// int bracketPos = name.indexOf('[');
// int endPos = bracketPos>=0?bracketPos:name.length();
// PropertyInfo prop = null;
// String prefix = null;
// while (endPos>0 && prop==null) {
// prefix = name.substring(0, endPos);
// String canonicalPrefix = StringUtil.camelCaseToHyphens(prefix);
// prop = index.get(canonicalPrefix);
// if (prop==null) {
// endPos = name.lastIndexOf('.', endPos-1);
// }
// }
// if (prop!=null) {
// //We should meet caller's expectation that matched properties returned by this method
// // match the names exactly even if we found them using relaxed name matching.
// return prop.withId(prefix);
// }
// return null;
// }
}