Skip to content

feat: implement comprehensive Ktor multiline routing support#44

Merged
zerochae merged 1 commit intomasterfrom
feature/ktor-multiline-complete
Sep 24, 2025
Merged

feat: implement comprehensive Ktor multiline routing support#44
zerochae merged 1 commit intomasterfrom
feature/ktor-multiline-complete

Conversation

@zerochae
Copy link
Copy Markdown
Owner

PR 내용

Summary

  • ✅ Add complete multiline routing pattern detection and parsing for Ktor
  • ✅ Support nested route() base paths with multiline definitions
  • ✅ Implement end_line_number for proper multiline highlighting
  • ✅ Fix root path handling bug in Parser.combine_paths() method

Changes Made

Core Parser Improvements

  • Fixed combine_paths() method to properly handle root paths ("/" + "/" = "/")
  • Added special case handling for root endpoint combinations

Ktor Parser Enhancements

  • Multiline routing detection: _is_multiline_routing() identifies patterns like get(
  • Multiline path extraction: _extract_path_multiline() reads across multiple lines to find full routing definition
  • Multiline base path support: Enhanced _extract_base_paths_from_file() to handle multiline route() declarations
  • End-to-end highlighting: Added end_line_number support for complete multiline highlighting

Complex Pattern Support

Now supports complex multiline patterns like:

route(
  "/api/multiline"
){
  get(
    "/users/{id}"
  ) {
    // handler code
  }
}

Type Safety

  • Updated meta/types.lua with new method signatures
  • Added proper type annotations for multiline functions

Test Results

  • ✅ Multiline endpoints properly detected: GET /api/multiline/users/{id}
  • ✅ Base paths correctly combined from nested route() blocks
  • ✅ Full range highlighting (lines 17-19) working in previewers
  • ✅ Root path edge cases fixed: GET / instead of GET (empty)

🤖 Generated with https://claude.ai/code

- Add multiline routing pattern detection and parsing
- Support nested route() base paths with multiline definitions
- Implement end_line_number for proper multiline highlighting
- Fix root path handling in Parser.combine_paths() method
- Support complex multiline patterns like:
  ```kotlin
  route(
    "/api/multiline"
  ){
    get(
      "/users/{id}"
    ) {
  ```
- Update type definitions for new parser methods
- Mark Ktor as completed (✅) in framework support checklist

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@zerochae zerochae merged commit c91dc9b into master Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant