Examples of FindDefinitionResult


Examples of dtool.engine.operations.FindDefinitionResult

    System.out.println(StringUtil.collToString(commandArguments.entrySet(), "\n"));
   
    Path modulePath = getPath(commandArguments, "filepath");
    int offset = getInt(commandArguments, "offset");
   
    FindDefinitionResult cmdResult = getDToolServer().doFindDefinition(modulePath, offset);
   
    if(cmdResult.errorMessage != null) {
      jsonWriter.writeProperty("error", cmdResult.errorMessage);
    }
   
View Full Code Here

Examples of dtool.engine.operations.FindDefinitionResult

    public FindDefinitionResult read(JsonReaderExt jsonParser) throws GenieCommandException, IOException {
      HashMap<String, Object> response = JsonReaderExt.readJsonObject(jsonParser);
     
      String errorMessage = getStringOrNull(response, "error");
      if(errorMessage != null) {
        return new FindDefinitionResult(errorMessage);
      }
     
      List<?> jsonResults = blindCast(response.get("results"));
      ArrayList<FindDefinitionResultEntry> results = new ArrayList<>();
     
      for (Object jsonResultEntry : nullToEmpty(jsonResults)) {
        results.add(findDefResult(jsonResultEntry));
      }
     
      return new FindDefinitionResult(results);
    }
View Full Code Here

Examples of dtool.engine.operations.FindDefinitionResult

  }
 
  protected void doTest(int offset, String errorMessageContains, IProject project, String editorFile)
      throws CoreException {
    EditorUtils.setEditorSelection(srcEditor, offset, 0);
    FindDefinitionResult opResult = new DeeOpenDefinitionHandler().createOperation(srcEditor,
      OpenNewEditorMode.TRY_REUSING_EXISTING_EDITORS).executeWithResult();
    assertTrue(errorMessageContains == null || opResult.errorMessage.contains(errorMessageContains));
   
    assertCurrentEditorIsEditing(project.getFullPath(), editorFile);
  }
View Full Code Here

Examples of melnorme.lang.tooling.ops.FindDefinitionResult

    JSONObject describe = jsonResult.getJSONObject("describe");
   
    String desc = describe.getString("desc");
   
    if(areEqual(desc, "source file")) {
      return new FindDefinitionResult(null, null);
    }
    if(!areEqual(desc, "identifier")) {
      return new FindDefinitionResult(
        "Selected name does not refer to a source element, rather it's a:\n" + desc, null);
    }
   
   
    JSONObject value = describe.getJSONObject("value");
   
    String pathStr = value.getString("objpos");
    // We will need to parse objpos from the end, because on Windows the filePath can contain the ':' char
   
    String columnStr = StringUtil.segmentAfterLastMatch(pathStr, ":");
    pathStr = StringUtil.substringUntilLastMatch(pathStr, ":");

    String lineStr = StringUtil.segmentAfterLastMatch(pathStr, ":");
    pathStr = StringUtil.substringUntilLastMatch(pathStr, ":");
   
   
    if(columnStr == null || lineStr == null) {
      throw new CommonException("No line or column position given.", null);
    }
    int line = parseInt(lineStr, "Invalid number for line: " + lineStr);
    int column = parseInt(columnStr, "Invalid number for column: " + columnStr);
   
    Path path = parsePath(pathStr);
   
    return new FindDefinitionResult(null, new SourceLineColumnLocation(path, line, column));
  }
View Full Code Here

Examples of melnorme.lang.tooling.ops.FindDefinitionResult

  public void test() throws Exception { test$(); }
  public void test$() throws Exception {
   
    GoOracleFindDefinitionOperation op = new GoOracleFindDefinitionOperation("gopath");
   
    FindDefinitionResult result = op.parseJsonResult(
      getClassResourceAsString(GoOracleFindDefinitionOperation_Test.class, "result1.json"));
   
    SourceLineColumnLocation loc = result.getLocation();
   
    assertEquals(loc, new SourceLineColumnLocation(
      path("D:\\devel\\tools.Go\\go-workspace\\src\\github.com\\user\\newmath\\sqrt.go"), 5, 6));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.