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

Selective Type Provider Error Highlighting #729

Open
voronoipotato opened this Issue Mar 28, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@voronoipotato
Copy link

voronoipotato commented Mar 28, 2019

Selective Type Provider Error Highlighting

I propose we add selective error highlighting for type providers that permits the type provider to add red squiggles to any part of the string instead of strictly the entire string.

do
    use cmd = new SqlCommandProvider<"
        SELECT TOP(@topN) FirstName, LastName, SalesYTD 
        _FRMO_ Sales.vSalesPerson
        WHERE CountryRegionName = @regionName AND SalesYTD > @salesMoreThan 
        ORDER BY SalesYTD
        " , connectionString>(connectionString)
    cmd.Execute(topN = 3L, regionName = "United States", salesMoreThan = 1000000M) |> printfn "%A"

in this example the whole SqlCommandProvider would be red in how it works now instead of simply highlighting "FRMO" which should be "FROM".

The existing way of approaching this problem in F# is to make the whole string red.

Pros and Cons

The advantages of making this adjustment to F# are ...

It makes existing usages of type providers more user friendly. It also goes well with this proposal. #556

The disadvantages of making this adjustment to F# are ...

more work

Extra information

Estimated cost (XS, S, M, L, XL, XXL):
S
Related suggestions: (put links to related suggestions here)

Affidavit (please submit!)

Please tick this by placing a cross in the box:

  • This is not a question (e.g. like one you might ask on stackoverflow) and I have searched stackoverflow for discussions of this issue
  • I have searched both open and closed suggestions on this site and believe this is not a duplicate
  • This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.

Please tick all that apply:

  • This is not a breaking change to the F# language design
  • I or my company would be willing to help implement and/or test this
@smoothdeveloper

This comment has been minimized.

Copy link

smoothdeveloper commented Mar 28, 2019

I tend to move those into separate .sql (or .json, whatever it is) files.

Editing the .sql file will show the error.

What would be amazing is if the type provider could report resources (uris for example) to the tooling, so an error in the resource would show as a link to edit the faulty file.

Having that feature in F# + TP SDK is indeed a first step in that direction and perfectly blends with what has been driving the TP so far. +1.

@voronoipotato

This comment has been minimized.

Copy link
Author

voronoipotato commented Mar 29, 2019

yes being able to refer to other resources as well as specific regions of text in the TP would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.