Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String comments and function variables in Zed Python #63

Closed
maxjmohr opened this issue Dec 26, 2024 · 4 comments · Fixed by #64
Closed

String comments and function variables in Zed Python #63

maxjmohr opened this issue Dec 26, 2024 · 4 comments · Fixed by #64

Comments

@maxjmohr
Copy link

Still many differences compared to the neovim version (Catppuccin Frappé).

Neovim:
image

Zed:
image

Especially:

  • String comments
  • Function variables
@uncenter
Copy link
Member

(aka doc comments and variable parameters)

@uncenter
Copy link
Member

It should be mentioned that differences in the appearance of code syntax highlighting can also be due to editor differences, and not the theme. Specifically I believe some of these issues are due to differences in Zed's Tree-sitter queries, if you are familiar with those. Could you share the code snippet in this screenshot so I can reference it in testing?

@maxjmohr
Copy link
Author

@uncenter Yeah I get what you are saying. I could probably also adjust the doc comments and variable parameters syntax highlighting somewhere in my config, but this is of course not ideal for other users.

def regression(
    data: pd.DataFrame,
    regression: str = "bias_detected ~ C(scenario)",
    reg_type: str = "ols",
) -> None:
    "Regression to find out impact of scenarios on bias detections"
    # Regression
    if reg_type == "ols":
        model = smf.ols(regression, data=data)
    elif reg_type == "mixedlm":
        # Create column with bias + model
        data["biasmodel"] = data["bias"] + data["model"]

        model = smf.mixedlm(regression, data, groups=data["biasmodel"])
    else:
        raise ValueError("Invalid regression type")

    # Fit the model
    results = model.fit()

    # Print the formula bold
    print(
        "\n#----------------------------------------------------------------------------#"
    )
    print("####### Regression formula: #######")
    print(f"\033[1m{regression}\033[0m")
    print("\n####### Regression results: #######")
    print(results.summary())

@uncenter
Copy link
Member

uncenter commented Jan 1, 2025

The second issue you mention with function variables is a query issue in Zed and not fixable by us.

Neovim queries:

https://github.com/nvim-treesitter/nvim-treesitter/blob/e947d35bbf919ea88a24c21cb8afa4621e3cf547/queries/python/highlights.scm#L114-L167

Zed doesn't have these, trying to get the Zed team to start adopting query captures like variable.parameter in zed-industries/zed#22193 though.

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 a pull request may close this issue.

2 participants