private int previousBeforeDot(String documentContent, Position position) {
        int originalOffset = StringUtils.positionToOffset(documentContent, position);
        for (int offset = originalOffset - 1; offset >= 0; --offset) {
            if (Character.isWhitespace(documentContent.charAt(offset))) return -1;
            if (documentContent.charAt(offset) == '.') return originalOffset - offset + 1;
        }
        return -1;
    }
FieldsCompletionProvider
For completing user defined fields in a fieldset.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/lsp/schema/completion/provider/FieldsCompletion.java