Giter Site home page Giter Site logo

Comments (16)

rneatherway avatar rneatherway commented on June 21, 2024

Noticed that a string such as @"hello" isn't highlighted properly. Need to be aware that '@' prevents escaping.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Further, the single character '"' confuses matters.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

A (/ incorrectly opens a multiline comment, like (*, and it can't be closed.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Simple examples of the main known issues:

// Example of typeof not highlighted
let x (y: 'a) = typeof<'a>

// Example of raw string highlighted badly
let mystring = @"hello \"

// " // Terminate string

// Example of character " highlighted badly
let mychar = '"'

// " // Terminate string

// Example of triple-quoted string highlighted badly
let mystring2 = """ hello " """

// " // Terminate string

// Example of backtick-quoted definition highlighted badly
let ``this is a definition`` () = 1

// Example of class arguments staring with a '/' causing multiline comment
type T (//
         x: int) =
  let f y = x 

// Example of string in a comment causing it not to be highlighted as a comment
// This "should" be a comment

from zarchive-fsharpbinding.

finalpatch avatar finalpatch commented on June 21, 2024

I think the general rule is to highlight types, functions and variables where they are declared (not where they are referenced). This is how Emacs CC-Mode works, it makes sense to me, and is easier to implement. In this sense probably typeof('T) should not be highlighted, because this is not creating a type but referencing an existing type.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

This seems like a reasonable point of view to take re typeof. The string quoting problems are the main thing in that case.

Replying also to https://github.com/rneatherway/fsharpbinding/pull/1#issuecomment-12635767 (let's continue discussion here):

I noticed that the .>>? problems are transient depending on whether or not that code is followed by another definition. Regarding fsi, I think you are right and we should probably turn off highlighting there as it is quite fragile.

from zarchive-fsharpbinding.

finalpatch avatar finalpatch commented on June 21, 2024

Like I have said the "? spaces" thing is caused by these lines
;labels (and open)
;;
'("<(assert|open|include|module|namespace|extern|void)>|[~?][
(][a-z][a-zA-Z0-9']_"
;; . font-lock-variable-name-face)

I don't understand why sequences start with ? or ~ should be highlighted.
If you just want to fix this case you could simply remove the "?" in the
above regexp.

To me the biggest problem is the indenting engine. It doesn't work very
well in pattern match expressions (the next line must be indented to the
right of the "match"). eg.
let doAdd (args : list) =
args
|>List.fold (fun acc x -> match x with
| INT n -> acc + n
| _ -> failwith ("can only add INTs")) 0
|> INT
in this example, the patterns inside the lambda function has to be manually
aligned to the previous line. The indenting engine cannot handle it.

Another indenting problem is in computation expressions (such async
workflows). It simply doesn't work inside {}. This is quite annoying
because computation expression is a very important part of the F# language.

Fixing these problems requires a lot more elisp skill than tweaking regexps
and therefore has exceeded my knowledge.

On Thu, Jan 24, 2013 at 9:55 PM, Robin Neatherway
[email protected]:

This seems like a reasonable point of view to take re typeof. The string
quoting problems are the main thing in that case.

Replying also to rneatherway#1https://github.com/rneatherway/fsharpbinding/issues/1#issuecomment-12635767(let's continue discussion here):

I noticed that the .>>? problems are transient depending on whether or
not that code is followed by another definition. Regarding fsi, I think you
are right and we should probably turn off highlighting there as it is quite
fragile.


Reply to this email directly or view it on GitHubhttps://github.com//issues/70#issuecomment-12646250.

Feng Li

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Yes I see the same problem. It is quite a large chunk of elisp so I haven't braved it yet either.

from zarchive-fsharpbinding.

 avatar commented on June 21, 2024

I might be hijacking this issue thread, but: I noticed an issue with multi-line strings. The following does not get highlighted:

let x = "btx a
abc" 

It seems the space after btx causes the error, if no space is there, highlighting works fine. I think it has to do with fsharp-mode-indent.el:119 but I don't know how to fix this with regex.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Thanks for the report. We should get to this sometime, but I still haven't found time to dig into that section of the code.

from zarchive-fsharpbinding.

 avatar commented on June 21, 2024

Based on below comment, removed additional issue, will create separate issue.

from zarchive-fsharpbinding.

knocte avatar knocte commented on June 21, 2024

Please create one github issue per problem, do NOT report many problems in the same github issue.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Fixed by #292

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

I found another bad example if there are keywords inside a namespace:

open Microsoft.FSharp.Compiler.AbstractIL.Internal

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Keyword highlighting should be case sensitive.

from zarchive-fsharpbinding.

rneatherway avatar rneatherway commented on June 21, 2024

Closed by #496

from zarchive-fsharpbinding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.