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

Proposal: highlight exposed functions #181

Open
BuddhiLW opened this issue Jan 31, 2022 · 1 comment
Open

Proposal: highlight exposed functions #181

BuddhiLW opened this issue Jan 31, 2022 · 1 comment

Comments

@BuddhiLW
Copy link

BuddhiLW commented Jan 31, 2022

Although imports itself are colored, the elements exposed are not. This makes the code look very "monotonic".

Example of what I'm saying. Html.Events is highlighted, but the onClick is not. I would appreciate if I could modulate the color of these exposed functions.

pic-selected-220131-1435-21

In text format:

import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Random


urlPrefix : String
urlPrefix =
    "http://elm-in-action.com/"


type Msg
    = ClickedPhoto String
    | ClickedSize ThumbnailSize
    | ClickedSurpriseMe


view : Model -> Html Msg
view model =
    div [ class "content" ]
        [ h1 [] [ text "Photo Groove" ]
        , button [ Html.Events.onClick ClickedSurpriseMe ] [ text "Surprise Me!" ]
        ]

Also, self-made functions and imported ones could have close colors, but slightly different.

Maybe to be considered in the same vein: self-declared variables, like urlPrefix in my code, which has color only when being declared, but not in the code itself. Local and global variables in a file could be colored with slightly different colors.

As it is, my code is monotonically white... These two excerpts-images I linked have both examples of all the things I mentioned, urlPrefix, model, onClick etc.

pic-selected-220131-1446-44

In text format:

view : Model -> Html Msg
view model =
    div [ class "content" ]
        [ h1 [] [ text "Photo Groove" ]
        , button [ Html.Events.onClick ClickedSurpriseMe ] [ text "Surprise Me!" ]
        , h3 [] [ text "Thumbnail Size:" ]
        , div [ id "choose-size" ]
            (List.map viewSizeChooser [ Small, Medium, Large ])
        , div [ id "thumbnails", class (sizeToString model.chosenSize) ]
            (List.map (viewThumbnail model.selectedUrl) model.photos)
        , img
            [ class "large"
            , src (urlPrefix ++ "large/" ++ model.selectedUrl)
            ]
            []
        ]
@purcell
Copy link
Collaborator

purcell commented Feb 1, 2022

I don't think it would be practical to get into any colouring that would require semantic analysis. Presumably you'd want "onClick" to be highlighted the same whether it was imported qualified or unqualified, and that would be hard!

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

No branches or pull requests

2 participants