Java Code Examples for graphql.language.SourceLocation#getColumn()
The following examples show how to use
graphql.language.SourceLocation#getColumn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GqlIssueContainer.java From manifold with Apache License 2.0 | 6 votes |
@SuppressWarnings("WeakerAccess") public void addIssues( List<GraphQLError> errors ) { for( GraphQLError e: errors ) { Optional<SourceLocation> loc = e.getLocations().stream().findFirst(); int line = 0; int column = 0; int offset = 0; if( loc.isPresent() ) { SourceLocation sourceLocation = loc.get(); line = sourceLocation.getLine(); column = sourceLocation.getColumn(); offset = IFileUtil.findOffset( _file, line, column ); } _issues.add( new GqlIssue( IIssue.Kind.Error, offset, line, column, e.getMessage() ) ); } }
Example 2
Source File: GraphQlFailedException.java From timbuctoo with GNU General Public License v3.0 | 5 votes |
@Override public String getMessage() { String result = ""; for (GraphQLError error : errors) { result += error.getErrorType() + ": " + error.getMessage() + "\n"; for (SourceLocation sourceLocation : error.getLocations()) { result += " at line: " + sourceLocation.getLine() + " column: " + sourceLocation.getColumn(); } } return result; }
Example 3
Source File: GraphQLValidationAnnotator.java From js-graphql-intellij-plugin with MIT License | 4 votes |
private int getOffsetFromSourceLocation(PsiFile psiFile, SourceLocation location) { com.intellij.openapi.editor.Document document = PsiDocumentManager.getInstance(psiFile.getProject()).getDocument(getTopLevelFile(psiFile)); return document != null ? document.getLineStartOffset(location.getLine() - 1) + location.getColumn() - 1 : -1; }