Skip to content

Fix popup mode error display - respect configured mode setting - #253

Draft
jellydn with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-249
Draft

Fix popup mode error display - respect configured mode setting#253
jellydn with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-249

Conversation

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

The error handling in hurl.nvim was hardcoded to use split mode, ignoring the user's configured popup mode setting. When a Hurl command failed (e.g., HTTP version mismatch, assertion failures), errors were always displayed in split view even when the user had explicitly configured popup mode.

Root Cause:
In lua/hurl/lib/hurl_runner.lua lines 357-358, the error handling code was hardcoded:

-- Show error in split view
local split = require('hurl.split')
split.show(error_data, 'markdown')

Solution:
Updated the error handling to respect the configured mode dynamically:

-- Show error in configured mode (popup or split)
local ok, error_display = pcall(require, 'hurl.' .. (_HURL_GLOBAL_CONFIG.mode or 'split'))
if not ok then
  utils.notify('Failed to load display module: ' .. error_display, vim.log.levels.ERROR)
  return
end
error_display.show(error_data, 'markdown')

Additional Changes:

  • Updated notification message to reference the correct mode dynamically
  • Added proper error handling with pcall for consistency with existing codebase patterns (matching history.lua:24 and main.lua:381)

Testing:
Users can verify the fix by:

  1. Setting mode = 'popup' in their hurl.nvim configuration
  2. Creating a Hurl file with a failing assertion (e.g., expecting status 404 when API returns 200)
  3. Running the file - errors now correctly appear in popup mode instead of split mode

Fixes #249.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@jellydn 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@codesandbox

codesandbox Bot commented Sep 16, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot

changeset-bot Bot commented Sep 16, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: eeb83ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: jellydn <870029+jellydn@users.noreply.github.com>
Copilot AI changed the title [WIP] Hurl error split view even with popup set Fix popup mode error display - respect configured mode setting Sep 16, 2025
Copilot AI requested a review from jellydn September 16, 2025 11:49
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.

Hurl error split view even with popup set

2 participants