Skip to content

[BUG]: C# nameof incorrectly flagged as spelling error #140

@andrewlock

Description

@andrewlock

Issue Description

Hi, thanks for this! I'm just trying out Zed for the first time, and a spell check is essential so was very happy to find this extension. I saw that C# said it needs validation so decided to give it a try and noticed that nameof flagged as spelling errors that shouldn't be. The interesting thing is that it was only flagged when part of an interpolated string, not in "normal" usage:

Image

I had a look around and couldn't find any other issues, nice work!

Operating System

Windows

Editor

Zed

Codebook Version

0.2.2

Configuration

I'm using the zed extension and haven't customised, I wasn't sure where to find the config

Steps to Reproduce

Install the extension, open C# project

Expected Behavior

None of the nameof should be flagged as a spelling error

Actual Behavior

The nameof calls inside the string interpolation are flagged as spelling errors

Code Sample

The following C# demonstrates the issue (in the interpolated strings)


using System.Diagnostics;

// Incorrectly flagged
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
internal class Program
{
    private static void Main(string[] args)
    {
        // Incorrectly flagged
        Console.WriteLine($"Hello, {nameof(Program)}!");

        // Incorrectly flagged
        Console.WriteLine(
            $$"""
            Hello {{nameof(Program)}}!
            """);
    }
    private string GetDebuggerDisplay()
    {
        // OK
        return nameof(Program);
    }
}

Log Output

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions