diff --git a/src/main/java/software/amazon/smithy/lsp/ext/FileCachingCollector.java b/src/main/java/software/amazon/smithy/lsp/ext/FileCachingCollector.java index ec9c8ef5..334bcd28 100644 --- a/src/main/java/software/amazon/smithy/lsp/ext/FileCachingCollector.java +++ b/src/main/java/software/amazon/smithy/lsp/ext/FileCachingCollector.java @@ -240,7 +240,10 @@ private Optional getOperationForInlinedInputOrOutput(Shape shape String suffix = getOperationInputOrOutputSuffix(shape, preamble); String shapeName = shape.getId().getName(); - String matchingOperationName = shapeName.substring(0, shapeName.length() - suffix.length()); + String matchingOperationName = + shapeName.endsWith(suffix) + ? shapeName.substring(0, shapeName.length() - suffix.length()) + : shapeName; ShapeId matchingOperationId = ShapeId.fromParts(shape.getId().getNamespace(), matchingOperationName); return model.shapes(OperationShape.class)