Loading ...
Sorry, an error occurred while loading the content.

[vim] syntax-files and spellchecking

Expand Messages
  • Luc Hermitte
    Hello, I have a little request that I would like syntax-file maintainers to think about. I m currently finishing my spell-checker plugin [1], and I am able to
    Message 1 of 11 , Sep 2, 2003
    • 0 Attachment
      Hello,

      I have a little request that I would like syntax-file maintainers to
      think about.


      I'm currently finishing my spell-checker plugin [1], and I am able to
      automatically adapt the plugin to most syntax schemes (60 to 80%)

      What I mean is that I am able to extract comments and strings for
      documents of almost any filetype, and to add new syntax items to some
      existing schemes (in order to highlight in the Error style (red) the
      misspellings).

      The first point is my problem only. However, on the second point, you
      (syntax-file maintainers) can help me (and the other developers of
      spellchecker plugins).

      Today, the difficulty is to automatically determine the syntax items in
      which the misspellings must be contained (:h :syn-containedin).


      It is possible [2] to support an infinity of special cases (as far as HD
      size is infinite), but it would be nicer to be able to generalize the
      processing required.


      With some filetypes, it is quite easy to automatically define what a
      comment or a string is, but with others it is an headache.

      Check for instance, all the languages that support embedded code from
      other languages (like vimL, php, ...).
      Their grammar and thus their syntax files are complex, and it is not
      easy to determine the exhaustive list of syntax items I'm looking for.

      [Moreover, sometimes the syntax scheme for the filetype ft is not defined
      by {ft}.vim but by {ft-ancestor}.vim ; e.g. C++ uses cString, cCppString
      and cCommentGroup, and not cppString, ...]



      In order to ease the task I am working on, I see several possible
      approaches. After a long reflexion, I've come to the conclusion that the
      terrific idea from Claudio Fleiner is the easiest and the best of all.

      He seems to have written all the syntax files he maintains with
      spellchecking considerations in mind. Thus, when a syntax item may
      contain text that is "misspellable", he defines that syntax item with
      "contains=@Spell". Check $VIMRUNTIME/syntax.java.vim for instance.


      So, if you have a little time to gave thoughts on what spellchecking
      could bring [3] to the filetypes (for which you maintain the syntax
      file) and how to integrate it ("it" being the "@Spell" cluster), I'll be
      very happy.
      It is not an obligation, or anything like that, -- as anyway I'll try to
      support the maximum number of filetypes before the end-user notice he is
      coding in a language that is not supported (yet) --, but a wish of
      cooperation between us.


      Thanks for your time.

      [1] The curious may found a beta version of the plugin at:
      <http://hermitte.free.fr/vim/ressources/vim-spell.tar.gz>
      It requires Vim 6.2 and
      <http://hermitte.free.fr/vim/ressources/searchInRuntime.tar.gz>
      I still have several tests to conduct, but so far it seems to work
      correctly with C&C++ (even doxygenized) files, Java files, sh files,
      pure VimL files, and some others.
      [2] An it works fine with the few special cases I'm already supporting
      [3] Spell-checking some type of files does not necessary have a sense. But
      unfortunately, I can not know every possible type of file.
      --
      Luc Hermitte
      http://hermitte.free.fr/vim/
    • Mathieu CLABAUT
      ... As vimspell devleopper, I totally support Luc Hermitte request. ... ... ... ... And so will I. It indeed seems the
      Message 2 of 11 , Sep 2, 2003
      • 0 Attachment
        On Tue, 2 Sep 2003, Luc Hermitte wrote:

        > Hello,
        > I have a little request that I would like syntax-file maintainers to
        > think about.

        As vimspell devleopper, I totally support Luc Hermitte request.

        > I'm currently finishing my spell-checker plugin [1], and I am able to
        > automatically adapt the plugin to most syntax schemes (60 to 80%)
        <snip>
        > The first point is my problem only. However, on the second point, you
        > (syntax-file maintainers) can help me (and the other developers of
        > spellchecker plugins).
        <Big approval nod, here>
        >
        <snip>
        > So, if you have a little time to gave thoughts on what spellchecking
        > could bring to the filetypes (for which you maintain the syntax
        > file) and how to integrate it ("it" being the "@Spell" cluster), I'll be
        > very happy.
        And so will I. It indeed seems the best solution. Syntax-file
        maintainers seem to be the best person to define which part of a file
        may deem spellchecking.

        -mat

        --
        ________________http://www.gnu.org/philosophy/no-word-attachments.fr.html
        Mathieu CLABAUT mailto:mathieu.clabaut@...
        F2F5 442F F2AC E1D5 9D31 3EFC 842A BC4A 123B 9A65
      • Charles E. Campbell
        ... As the developer of engspchk, I concur. Sounds related to my longstanding request to syntax file writers to have comments contain a cluster (unlike Luc, I
        Message 3 of 11 , Sep 2, 2003
        • 0 Attachment
          On Tue, 2 Sep 2003, Luc Hermitte wrote:
          > I have a little request that I would like syntax-file maintainers to
          > think about...
          > So, if you have a little time to gave thoughts on what spellchecking
          > could bring to the filetypes (for which you maintain the syntax
          > file) and how to integrate it ("it" being the "@Spell" cluster), I'll be
          > very happy.

          On Tue, Sep 02, 2003 at 04:24:54PM +0200, Mathieu CLABAUT wrote:
          > As vimspell devleopper, I totally support Luc Hermitte request.
          > And so will I. It indeed seems the best solution. Syntax-file
          > maintainers seem to be the best person to define which part of a file
          > may deem spellchecking.

          As the developer of engspchk, I concur. Sounds related to my
          longstanding request to syntax file writers to have comments
          contain a cluster (unlike Luc, I didn't name any specific
          cluster). That way I could add engspchk'ing to the cluster
          which, in turn, would get included by the comment.

          Regards,
          Chip Campbell

          --
          Charles E Campbell, Jr, PhD _ __ __
          Goddard Space Flight Center / /_/\_\_/ /
          cec@... /_/ \/_//_/
          PGP public key: http://www.erols.com/astronaut/pgp.html
        • Luc Hermitte
          Hello, ... Perfectly (almost) ! Thank you for your quick response! (almost - ) It could be also interresting to add the @Spell cluster to cString and
          Message 4 of 11 , Sep 3, 2003
          • 0 Attachment
            Hello,

            * On Tue, Sep 02, 2003 at 06:07:26PM +0200, Bram Moolenaar <Bram@...> wrote:
            > > He [Claudio] seems to have written all the syntax files he maintains
            > > with spellchecking considerations in mind. Thus, when a syntax item
            > > may contain text that is "misspellable", he defines that syntax item
            > > with "contains=@Spell". Check $VIMRUNTIME/syntax.java.vim for
            > > instance.
            >
            > I have added @Spell to the cComment groups. Check out the version at:
            > ftp://ftp.vim.org/pub/vim/runtime/syntax/c.vim
            > Does this work?

            Perfectly (almost) ! Thank you for your quick response!

            (almost ->) It could be also interresting to add the @Spell cluster to
            cString and cCppString. Adding ",@Spell" to the 4 lines that define
            those two items seems to do the work for C and C++.


            * On Tue, Sep 02, 2003 at 11:44:17AM -0400, Charles E. Campbell <cec@...> wrote:
            > As the developer of engspchk, I concur. Sounds related to my
            > longstanding request to syntax file writers to have comments contain a
            > cluster (unlike Luc, I didn't name any specific cluster). That way I
            > could add engspchk'ing to the cluster which, in turn, would get
            > included by the comment.

            Actually, _I_ didn't named the cluster, I've just found out that Claudio
            already the brilliant idea to define this cluster in the several
            syntax-fileshe maintains.
            Then, all we have to do is to agree to a name for all syntax-files and
            use it.

            Regarding the {ft}CommentGroup, I'm using it as a second heuristic when
            @Spell is not defined.

            --
            Luc Hermitte
            http://hermitte.free.fr/vim/
          • Bram Moolenaar
            ... Spell checking strings? Hmm, I suppose it could be useful, although you might get quite a few non-errors there. -- Not too long ago, cut and paste was
            Message 5 of 11 , Sep 3, 2003
            • 0 Attachment
              Luc Hermitte wrote:

              > * On Tue, Sep 02, 2003 at 06:07:26PM +0200, Bram Moolenaar <Bram@...> wrote:
              > > > He [Claudio] seems to have written all the syntax files he maintains
              > > > with spellchecking considerations in mind. Thus, when a syntax item
              > > > may contain text that is "misspellable", he defines that syntax item
              > > > with "contains=@Spell". Check $VIMRUNTIME/syntax.java.vim for
              > > > instance.
              > >
              > > I have added @Spell to the cComment groups. Check out the version at:
              > > ftp://ftp.vim.org/pub/vim/runtime/syntax/c.vim
              > > Does this work?
              >
              > Perfectly (almost) ! Thank you for your quick response!
              >
              > (almost ->) It could be also interresting to add the @Spell cluster to
              > cString and cCppString. Adding ",@Spell" to the 4 lines that define
              > those two items seems to do the work for C and C++.

              Spell checking strings? Hmm, I suppose it could be useful, although you
              might get quite a few non-errors there.

              --
              Not too long ago, cut and paste was done with scissors and glue...

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
              \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
              \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
            • Luc Hermitte
              ... That s true. However, it could be managed from the spellchecker: I can provide an option to decide whether the spellchecking is done on strings or not [1].
              Message 6 of 11 , Sep 3, 2003
              • 0 Attachment
                * On Wed, Sep 03, 2003 at 12:06:08PM +0200, Bram Moolenaar <Bram@...> wrote:
                > Spell checking strings? Hmm, I suppose it could be useful, although
                > you might get quite a few non-errors there.

                That's true.

                However, it could be managed from the spellchecker: I can provide an
                option to decide whether the spellchecking is done on strings or not
                [1].
                In the case the option is set to "spellcheck-strings", I need to
                highlight the misspellings within the strings.

                Otherwise, a more complex solution would be to provide two clusters:
                @Spell and @SpellString for instance.

                If the non-error is "%s", it is easy (in my plugin at least) to add it
                to the list of ignored words -- just press <i>.
                But I guess you are refering to things like little abreviations
                programmers like to use (or things like that) since "%s" a cFormat.

                I don't know what others think on this issue.

                [1] I run a big, complex and automatically generated regex to extract only
                the things that can be mispelled (strings and comments).
                --
                Luc Hermitte
                http://hermitte.free.fr/vim/
              • Bram Moolenaar
                ... Ah, yes! An opportunity to add another option! We can t have enough of them! [Sorry, I m a bit frustrated after struggling with installing packages and
                Message 7 of 11 , Sep 3, 2003
                • 0 Attachment
                  Luc Hermitte wrote:

                  > * On Wed, Sep 03, 2003 at 12:06:08PM +0200, Bram Moolenaar <Bram@...> wrote:
                  > > Spell checking strings? Hmm, I suppose it could be useful, although
                  > > you might get quite a few non-errors there.
                  >
                  > That's true.
                  >
                  > However, it could be managed from the spellchecker: I can provide an
                  > option to decide whether the spellchecking is done on strings or not
                  > [1].
                  > In the case the option is set to "spellcheck-strings", I need to
                  > highlight the misspellings within the strings.

                  Ah, yes! An opportunity to add another option! We can't have enough of
                  them!

                  [Sorry, I'm a bit frustrated after struggling with installing packages
                  and lots of things that should work are failing...]

                  Let's try to keep it simple.

                  --
                  I have to exercise early in the morning before my brain
                  figures out what I'm doing.

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                  \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                  \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
                • Luc Hermitte
                  ... Don t worry. ... Right now, I just put this in the todo list of my plugin (it does not concern the syntax-file), and I may implement it only if some day I
                  Message 8 of 11 , Sep 3, 2003
                  • 0 Attachment
                    * On Wed, Sep 03, 2003 at 01:25:35PM +0200, Bram Moolenaar <Bram@...> wrote:
                    > > However, it could be managed from the spellchecker: I can provide an
                    > > option to decide whether the spellchecking is done on strings or not
                    > > [1].
                    > > In the case the option is set to "spellcheck-strings", I need to
                    > > highlight the misspellings within the strings.
                    >
                    > Ah, yes! An opportunity to add another option! We can't have enough
                    > of them!
                    >
                    > [Sorry,

                    Don't worry.

                    > I'm a bit frustrated after struggling with installing packages
                    > and lots of things that should work are failing...]

                    Right now, I just put this in the todo list of my plugin (it does not
                    concern the syntax-file), and I may implement it only if some day I have
                    someone asking for such "flexibility"

                    [However, that just concerns _my_ spellchecker plugin. The other
                    similar plugins I know about just "parse" [1] the whole file -- correct
                    me if I'm wrong. In other words, I can't speak for the developers of the
                    other spellchecker plugins. I am just guessing that the end-users will
                    be interrested in highlighting comments and strings.]

                    > Let's try to keep it simple.

                    I try, I try ... but it is not that easy :(
                    So many different configurations, expectations, filetypes, ...

                    [1] or at least, are not directly able to treat the strings differently
                    than the comments if both "export" a same @Spell cluster -- supposing the
                    plugins use @Spell, which is not yet (?) the case.
                    --
                    Luc Hermitte
                    http://hermitte.free.fr/vim/
                  • Charles E. Campbell
                    ... Strings are definitely likely to add considerable numbers of errors. I think its more trouble than an extra-option would be worth, myself. I ve added the
                    Message 9 of 11 , Sep 3, 2003
                    • 0 Attachment
                      On Wed, Sep 03, 2003 at 01:25:35PM +0200, Bram Moolenaar <Bram@...> wrote:
                      > Ah, yes! An opportunity to add another option! We can't have enough
                      > of them!

                      Strings are definitely likely to add considerable numbers of errors.
                      I think its more trouble than an extra-option would be worth, myself.
                      I've added the @Spell cluster to 13 syntax highlighting files...

                      On Wed, Sep 03, 2003 at 02:13:31PM +0200, Luc Hermitte wrote:
                      > [However, that just concerns _my_ spellchecker plugin. The other
                      > similar plugins I know about just "parse" [1] the whole file -- correct
                      > me if I'm wrong. In other words, I can't speak for the developers of the
                      > other spellchecker plugins. I am just guessing that the end-users will
                      > be interrested in highlighting comments and strings.]

                      Engspchk checks non-highlighted text, plus some syntax highlighted
                      files that had their comments containing a cluster (to which I could
                      add spellchecking). Its next release will include @Spell.

                      Regards,
                      Chip Campbell

                      --
                      Charles E Campbell, Jr, PhD _ __ __
                      Goddard Space Flight Center / /_/\_\_/ /
                      cec@... /_/ \/_//_/
                      PGP public key: http://www.erols.com/astronaut/pgp.html
                    • Pan Shizhu
                      ... So, are the @Spell is officially supported as the Spell check cluster? If so, I will add the cluster into my syntax file. Pan
                      Message 10 of 11 , Sep 5, 2003
                      • 0 Attachment
                        Charles E. Campbell wrote:
                        > On Wed, Sep 03, 2003 at 01:25:35PM +0200, Bram Moolenaar <Bram@...> wrote:
                        >
                        >
                        > Engspchk checks non-highlighted text, plus some syntax highlighted
                        > files that had their comments containing a cluster (to which I could
                        > add spellchecking). Its next release will include @Spell.
                        >
                        > Regards,
                        > Chip Campbell
                        >

                        So, are the @Spell is officially supported as the Spell check cluster?

                        If so, I will add the cluster into my syntax file.

                        Pan
                      • Bram Moolenaar
                        ... More or less. Other than the discussion of Comments vs Strings I have not heard an objection to using @Spell. -- ARTHUR: Then who is your lord? WOMAN:
                        Message 11 of 11 , Sep 5, 2003
                        • 0 Attachment
                          Pan Shizhu wrote:

                          > Charles E. Campbell wrote:
                          > > On Wed, Sep 03, 2003 at 01:25:35PM +0200, Bram Moolenaar <Bram@...> wrote:
                          > >
                          > >
                          > > Engspchk checks non-highlighted text, plus some syntax highlighted
                          > > files that had their comments containing a cluster (to which I could
                          > > add spellchecking). Its next release will include @Spell.
                          > >
                          > > Regards,
                          > > Chip Campbell
                          > >
                          >
                          > So, are the @Spell is officially supported as the Spell check cluster?
                          >
                          > If so, I will add the cluster into my syntax file.

                          More or less. Other than the discussion of Comments vs Strings I have
                          not heard an objection to using @Spell.

                          --
                          ARTHUR: Then who is your lord?
                          WOMAN: We don't have a lord.
                          ARTHUR: What?
                          DENNIS: I told you. We're an anarcho-syndicalist commune. We take it in
                          turns to act as a sort of executive officer for the week.
                          The Quest for the Holy Grail (Monty Python)

                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                          /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                          \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
                        Your message has been successfully submitted and would be delivered to recipients shortly.