Skip to content

lsp: Add code action and command to ignore rule#1777

Merged
charlieegan3 merged 4 commits intoopen-policy-agent:mainfrom
charlieegan3:ignore-code-action
Nov 20, 2025
Merged

lsp: Add code action and command to ignore rule#1777
charlieegan3 merged 4 commits intoopen-policy-agent:mainfrom
charlieegan3:ignore-code-action

Conversation

@charlieegan3
Copy link
Copy Markdown
Contributor

Fixes #622

Screen.Recording.2025-11-18.at.14.46.40.mov

@charlieegan3 charlieegan3 force-pushed the ignore-code-action branch 3 times, most recently from 274b4ce to 770b610 Compare November 18, 2025 14:57
@charlieegan3 charlieegan3 reopened this Nov 18, 2025
Fixes open-policy-agent#622

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
Copy link
Copy Markdown
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just one question.

Comment thread internal/lsp/server.go Outdated

var currentContent string

if _, err := os.Stat(configPath); err == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the stat fails here, we'll just proceed as normal? That doesn't seem right. even if it is unlikely to fail. I'd just call os.ReadFile directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense, fixed in db0ae2d

)

// SetKey sets a key at the given path to the specified value.
// Comments are preserved, but indentation is always 2.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As God intended for YAML.

Did you try this on a more "complex" configuration file, like our own?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2025-11-19.at.14.43.31.mov

it seems to work ok from what I can tell.

style:
prefer-snake-case:
level: error # Important rule
# Additional configuration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
@charlieegan3 charlieegan3 enabled auto-merge (squash) November 19, 2025 14:44
Signed-off-by: Charlie Egan <charlie_egan@apple.com>
Signed-off-by: Charlie Egan <charlie_egan@apple.com>
auto-merge was automatically disabled November 20, 2025 15:23

Pull request was closed

@charlieegan3 charlieegan3 reopened this Nov 20, 2025
@charlieegan3 charlieegan3 enabled auto-merge (squash) November 20, 2025 15:33
@charlieegan3 charlieegan3 merged commit 877884c into open-policy-agent:main Nov 20, 2025
15 checks passed
@charlieegan3 charlieegan3 deleted the ignore-code-action branch November 20, 2025 15:34
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.

Implement LSP code action for disabling rule in configuration

2 participants