Skip to content

Commit d13f418

Browse files
committed
Address comments
1 parent 95a56aa commit d13f418

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

src/main/java/software/amazon/smithy/lsp/document/Document.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public Range rangeOf(Syntax.Item item) {
217217
* @return The range of the token, excluding enclosing ""
218218
*/
219219
public Range rangeOfValue(Syntax.Node.Str token) {
220-
int lineStart = indexOfLine(token.line());
220+
int lineStart = indexOfLine(token.lineNumber());
221221
if (lineStart < 0) {
222222
return null;
223223
}
@@ -230,7 +230,7 @@ public Range rangeOfValue(Syntax.Node.Str token) {
230230
endChar -= 1;
231231
}
232232

233-
return new Range(new Position(token.line(), startChar), new Position(token.line(), endChar));
233+
return new Range(new Position(token.lineNumber(), startChar), new Position(token.lineNumber(), endChar));
234234
}
235235

236236
/**

src/main/java/software/amazon/smithy/lsp/language/ReferencesHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ static Config create(Project project, IdlFile idlFile, Position position) {
7373
private static ResponseErrorException notSupported() {
7474
var error = new ResponseError();
7575
error.setCode(ResponseErrorCode.RequestFailed);
76-
error.setMessage("Not supported here.");
76+
error.setMessage("Finding references not supported here.");
7777
return new ResponseErrorException(error);
7878
}
7979

8080
private static ResponseErrorException noModel() {
8181
var error = new ResponseError();
8282
error.setCode(ResponseErrorCode.RequestFailed);
83-
error.setMessage("Model is too broken.");
83+
error.setMessage("Model is too broken to find references.");
8484
return new ResponseErrorException(error);
8585
}
8686
}

src/main/java/software/amazon/smithy/lsp/language/RenameHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ private void deconflictDefinition() {
106106
return;
107107
}
108108

109-
var conflictingShape = ShapeSearch.findShape(sourceFile.getParse(), conflictingId, config.model())
110-
.orElse(null);
111-
if (conflictingShape == null) {
109+
var conflictingShape = ShapeSearch.findShape(sourceFile.getParse(), conflictingId, config.model());
110+
if (conflictingShape.isEmpty()) {
112111
return;
113112
}
114113

115-
var references = References.findReferences(config.model(), conflictingShape, sourceFile);
114+
var references = References.findReferences(config.model(), conflictingShape.get(), sourceFile);
116115
for (var fileReferences : references.fileReferences()) {
117116
addConflictRenames(fileReferences, conflictingId);
118117
}

src/main/java/software/amazon/smithy/lsp/syntax/Syntax.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,18 @@ public List<Node> elements() {
293293
* identifiers, so this class a single subclass {@link Ident}.
294294
*/
295295
public static sealed class Str extends Node {
296-
final int line;
296+
final int lineNumber;
297297
final String value;
298298

299-
Str(int line, int start, int end, String value) {
300-
this.line = line;
299+
Str(int lineNumber, int start, int end, String value) {
300+
this.lineNumber = lineNumber;
301301
this.start = start;
302302
this.end = end;
303303
this.value = value;
304304
}
305305

306-
public int line() {
307-
return line;
306+
public int lineNumber() {
307+
return lineNumber;
308308
}
309309

310310
public String stringValue() {
@@ -806,8 +806,8 @@ public String message() {
806806
public static final class Ident extends Node.Str {
807807
static final Ident EMPTY = new Ident(-1, -1, -1, "");
808808

809-
Ident(int line, int start, int end, String value) {
810-
super(line, start, end, value);
809+
Ident(int lineNumber, int start, int end, String value) {
810+
super(lineNumber, start, end, value);
811811
}
812812

813813
public boolean isEmpty() {

src/test/java/software/amazon/smithy/lsp/language/ReferencesHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public void unsupportedReferences() {
292292

293293
for (var position : twp.positions()) {
294294
assertThat(() -> ReferencesHandler.Config.create(project, idlFile, position),
295-
throwsWithMessage(containsString("Not supported")));
295+
throwsWithMessage(containsString("not supported")));
296296
}
297297
}
298298

0 commit comments

Comments
 (0)