www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Request d.vim testing

reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
Hello Vim users,

Sadly I don't have a good set of unittests for highlighting. I've 
made some changes and think that it will be good to have them 
part of vim 7.4

I'm requesting that you check that the new file has not butchered 
highlighting for you.

https://github.com/JesseKPhillips/d.vim

* ASM blocks highlight comments
* in/out contracts no longer highlighted as storage class
* If a module name is the same as a keyword it will not be 
highlighted on module declaration or import.
* scope highlights as a statement, as a storage class in 
parameter list
* pragma will highlight known commands (lib,msg)
May 18 2013
next sibling parent reply "Anon" <z z.z> writes:
Works for me.

I'm glad to see you are still maintaining this - appreciate your 
work.
May 18 2013
parent 1100110 <0b1100110 gmail.com> writes:
On 05/18/2013 02:09 PM, Anon wrote:
 Works for me.
=20
 I'm glad to see you are still maintaining this - appreciate your work.
+1 I'll take a look over the next day or two.
May 18 2013
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, May 18, 2013 20:12:16 Jesse Phillips wrote:
 Hello Vim users,
 
 Sadly I don't have a good set of unittests for highlighting. I've
 made some changes and think that it will be good to have them
 part of vim 7.4
 
 I'm requesting that you check that the new file has not butchered
 highlighting for you.
 
 https://github.com/JesseKPhillips/d.vim
 
 * ASM blocks highlight comments
 * in/out contracts no longer highlighted as storage class
 * If a module name is the same as a keyword it will not be
 highlighted on module declaration or import.
 * scope highlights as a statement, as a storage class in
 parameter list
 * pragma will highlight known commands (lib,msg)
Using this new d.vim file, I get whole piles of errors just opening an empty .di file - starting off with Error detected while processing /home/jmdavis/.vim/syntax/d.vim line 4: E477: No ! allowed: <!DOCTYPE html> line 5: E488: Trailing characters: <html> and so on and so forth. I'm using vim 7.3 on Arch Linux. Maybe I need 7.4 for it to work? Or maybe something else in my setup is messed up. I only grabbed the syntax/d.vim file from your repo, since I don't know what the others are and don't currently have anything like them, so that may or may not be a factor. But based on the errors, it looks like my local version of vim just plain can't handle the new d.vim syntax file. - Jonathan M Davis
May 19 2013
parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Monday, 20 May 2013 at 02:24:44 UTC, Jonathan M Davis wrote:
 On Saturday, May 18, 2013 20:12:16 Jesse Phillips wrote:
 Hello Vim users,
 
 Sadly I don't have a good set of unittests for highlighting. 
 I've
 made some changes and think that it will be good to have them
 part of vim 7.4
 
 I'm requesting that you check that the new file has not 
 butchered
 highlighting for you.
 
 https://github.com/JesseKPhillips/d.vim
 
 * ASM blocks highlight comments
 * in/out contracts no longer highlighted as storage class
 * If a module name is the same as a keyword it will not be
 highlighted on module declaration or import.
 * scope highlights as a statement, as a storage class in
 parameter list
 * pragma will highlight known commands (lib,msg)
Using this new d.vim file, I get whole piles of errors just opening an empty .di file - starting off with Error detected while processing /home/jmdavis/.vim/syntax/d.vim line 4: E477: No ! allowed: <!DOCTYPE html> line 5: E488: Trailing characters: <html> and so on and so forth. I'm using vim 7.3 on Arch Linux. Maybe I need 7.4 for it to work? Or maybe something else in my setup is messed up. I only grabbed the syntax/d.vim file from your repo, since I don't know what the others are and don't currently have anything like them, so that may or may not be a factor. But based on the errors, it looks like my local version of vim just plain can't handle the new d.vim syntax file. - Jonathan M Davis
Are you sure you downloaded it correctly? From the error message you got, it seems like you have downloaded the source of the GitHub page that displays the `syntax/d.vim` file.
May 20 2013
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday, May 20, 2013 10:04:22 Idan Arye wrote:
 Are you sure you downloaded it correctly? From the error message
 you got, it seems like you have downloaded the source of the
 GitHub page that displays the `syntax/d.vim` file.
LOL. Yeah, that looks like it's what I did. I think that I got it correctly now though, and it seems to work (or at least, it works well enough that I can open .d files using it now without any errors - I haven't messed around with it enough yet to determine if it's having any further issues). - Jonathan M Davis
May 20 2013
prev sibling next sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Saturday, 18 May 2013 at 18:12:17 UTC, Jesse Phillips wrote:
 Hello Vim users,

 Sadly I don't have a good set of unittests for highlighting. 
 I've made some changes and think that it will be good to have 
 them part of vim 7.4
Here's the test file for D highlighting for the colorer library: https://svn.code.sf.net/p/colorer/svn/trunk/schemes/hrc/test/other/d-sample.d Hope this helps.
May 20 2013
next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 20 May 2013 10:08, Vladimir Panteleev <vladimir thecybershadow.net>wrote:

 On Saturday, 18 May 2013 at 18:12:17 UTC, Jesse Phillips wrote:

 Hello Vim users,

 Sadly I don't have a good set of unittests for highlighting. I've made
 some changes and think that it will be good to have them part of vim 7.4
Here's the test file for D highlighting for the colorer library: https://svn.code.sf.net/p/**colorer/svn/trunk/schemes/hrc/** test/other/d-sample.d<https://svn.code.sf.net/p/colorer/svn/trunk/schemes/hrc/test/other/d-sample.d> Hope this helps.
Thanks Vladimir, I'll test this against cgdb as well. =) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20 2013
prev sibling parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
On 20 May 2013 10:51, Iain Buclaw <ibuclaw ubuntu.com> wrote:
 On 20 May 2013 10:08, Vladimir Panteleev <vladimir thecybershadow.net>
 wrote:
 On Saturday, 18 May 2013 at 18:12:17 UTC, Jesse Phillips wrote:
 Hello Vim users,

 Sadly I don't have a good set of unittests for highlighting. I've made
 some changes and think that it will be good to have them part of vim 7.4
Here's the test file for D highlighting for the colorer library: https://svn.code.sf.net/p/colorer/svn/trunk/schemes/hrc/test/other/d-sample.d Hope this helps.
Thanks Vladimir, I'll test this against cgdb as well. =)
First question that I have: Does 'Object' *need* to be syntax highlighted? Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Monday, 20 May 2013 at 16:36:59 UTC, Iain Buclaw wrote:
 First question that I have:

 Does 'Object' *need* to be syntax highlighted?


 Regards
 --
 Iain Buclaw

 *(p < e ? p++ : p) = (c & 0x0f) + '0';
No, but nor does size_t... Object is always made available, so basically a keyword.
May 20 2013
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
Thanks.

I've fixed cgdb syntax highlighting for various literals here.

https://github.com/cgdb/cgdb/pull/22

Wonder if anyone has any ideas for q"( strings )"

Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
On May 20, 2013 11:40 PM, "Jesse Phillips" <Jessekphillips+D gmail.com>
wrote:

 On Monday, 20 May 2013 at 16:36:59 UTC, Iain Buclaw wrote:

 First question that I have:

 Does 'Object' *need* to be syntax highlighted?


 Regards
 --
 Iain Buclaw

 *(p < e ? p++ : p) = (c & 0x0f) + '0';
No, but nor does size_t... Object is always made available, so basically a keyword.
May 20 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Monday, 20 May 2013 at 23:08:26 UTC, Iain Buclaw wrote:
 Thanks.

 I've fixed cgdb syntax highlighting for various literals here.

 https://github.com/cgdb/cgdb/pull/22

 Wonder if anyone has any ideas for q"( strings )"

 Regards
In case you don't know (guessing you might not based on the comment): q{ Token string here } q"( custom wysiwyg string delimiter )" The first should probably highlight as normal code (Vim is doing that). The second is a normal string. The token string is interesting since it can be used to house non-D language making D not necessarily the proper highlighting scheme.... hmm I wonder if I could make vim.d identify the language (probably needs specific indicator though).
May 20 2013
next sibling parent reply "Brian Schott" <briancschott gmail.com> writes:
On Monday, 20 May 2013 at 23:20:08 UTC, Jesse Phillips wrote:
 The token string is interesting since it can be used to house 
 non-D language making D not necessarily the proper highlighting 
 scheme.... hmm I wonder if I could make vim.d identify the 
 language (probably needs specific indicator though).
The standard says "In between must be valid D tokens", so I'm not sure that's actually the case.
May 20 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Monday, 20 May 2013 at 23:30:48 UTC, Brian Schott wrote:
 On Monday, 20 May 2013 at 23:20:08 UTC, Jesse Phillips wrote:
 The token string is interesting since it can be used to house 
 non-D language making D not necessarily the proper 
 highlighting scheme.... hmm I wonder if I could make vim.d 
 identify the language (probably needs specific indicator 
 though).
The standard says "In between must be valid D tokens", so I'm not sure that's actually the case.
That just means it can be tokenized; pretty much anything can be tokenized. I was going to give an example of something that would fail... but I can't think of anything that should fail. My first thought was '45oau' since identifiers can't start with a number... but my testing shows this is accepted.
May 20 2013
parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 20 May 2013 at 23:57:21 UTC, Jesse Phillips wrote:
 I was going to give an example of something that would fail... 
 but I can't think of anything that should fail.
A string in single quotes doesn't pass. I use it for inline javascript sometimes and hits this: a.onclick = q{ var a = 'something'; // this won't compile in D - it will have to use double quotes return false; }; test.d(5): Error: unterminated character constant
May 20 2013
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On May 21, 2013 12:25 AM, "Jesse Phillips" <Jessekphillips+D gmail.com>
wrote:
 On Monday, 20 May 2013 at 23:08:26 UTC, Iain Buclaw wrote:
 Thanks.

 I've fixed cgdb syntax highlighting for various literals here.

 https://github.com/cgdb/cgdb/pull/22

 Wonder if anyone has any ideas for q"( strings )"

 Regards
In case you don't know (guessing you might not based on the comment): q{ Token string here } q"( custom wysiwyg string delimiter )" The first should probably highlight as normal code (Vim is doing that).
The second is a normal string.
 The token string is interesting since it can be used to house non-D
language making D not necessarily the proper highlighting scheme.... hmm I wonder if I could make vim.d identify the language (probably needs specific indicator though). The bit causing trouble is knowing the token that shall end the string. Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20 2013
prev sibling parent "Idan Arye" <GenericNPC gmail.com> writes:
On Monday, 20 May 2013 at 23:20:08 UTC, Jesse Phillips wrote:
 The token string is interesting since it can be used to house 
 non-D language making D not necessarily the proper highlighting 
 scheme.... hmm I wonder if I could make vim.d identify the 
 language (probably needs specific indicator though).
I used it for GLSL and it turned out nicely: https://github.com/someboddy/Dandy/blob/initial-development/dandy/common/shaders.d#L8L31 Many acceptable languages for token strings are c-like anyways, so they look good with the D syntax highlighting - even if it doesn't highlight all the keywords, or highlight stuff that are not keywords, or highlight in wrong color.
May 20 2013
prev sibling parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Saturday, 18 May 2013 at 18:12:17 UTC, Jesse Phillips wrote:
 Hello Vim users,

 Sadly I don't have a good set of unittests for highlighting. 
 I've made some changes and think that it will be good to have 
 them part of vim 7.4

 I'm requesting that you check that the new file has not 
 butchered highlighting for you.
Here are the results on my Vim 7.3 on Linux: http://postimg.org/image/cgtkbhr0t/ hybrid.vim was OK so I didn't put it in the screenshot(also I couldn't fit them all to screen height...)
 * ASM blocks highlight comments
/* */ comments are good, but /+ +/ comments are not ended. This is also true outside ASM blocks.
 * in/out contracts no longer highlighted as storage class
Works
 * If a module name is the same as a keyword it will not be 
 highlighted on module declaration or import.
Made worse - in the original syntax `assert` was not highlighted when used as module name. `string` and `void` are still highlighted as module names.
 * scope highlights as a statement, as a storage class in 
 parameter list
Works
 * pragma will highlight known commands (lib,msg)
Doesn't work
May 20 2013
parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Monday, 20 May 2013 at 16:20:34 UTC, Idan Arye wrote:
 Here are the results on my Vim 7.3 on Linux:
 http://postimg.org/image/cgtkbhr0t/
Are you sure you didn't have merge errors, The only indicator that you have the latest file is the asm.d highlighting, and I can't reproduce this. Anyone else seeing these?
May 20 2013
parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Monday, 20 May 2013 at 22:34:05 UTC, Jesse Phillips wrote:
 On Monday, 20 May 2013 at 16:20:34 UTC, Idan Arye wrote:
 Here are the results on my Vim 7.3 on Linux:
 http://postimg.org/image/cgtkbhr0t/
Are you sure you didn't have merge errors, The only indicator that you have the latest file is the asm.d highlighting, and I can't reproduce this. Anyone else seeing these?
Oopsie... my fault... I haven't really merged it or replaced the old file - I just `unlet`ted `b:current_syntax` and `source`d your syntax file, so I guess the two syntax files got mixed. I removed the suffix from the example files and loaded just your syntax, and everything turned out OK! Anyways, do you happen to know where we can get a proper indentation for D under Vim?
May 20 2013
next sibling parent "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Monday, 20 May 2013 at 22:51:52 UTC, Idan Arye wrote:
 Anyways, do you happen to know where we can get a proper 
 indentation for D under Vim?
Nope, most recent information I know is found here: http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/VimEditor
May 20 2013
prev sibling parent reply "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Tuesday, May 21, 2013 00:51:51 Idan Arye wrote:
 Anyways, do you happen to know where we can get a proper
 indentation for D under Vim?
What do you mean by proper indentantion? I just set tabstop and shiftwidth to 4 and then turn on cindent. Is there something that that doesn't cover? I'm probably just so used to how that works that I have no clue what you're missing. - Jonathan M Davis
May 20 2013
parent reply "Jesse Phillips" <jessek.phillips+D gmail.m> writes:
On Tuesday, 21 May 2013 at 00:17:56 UTC, Jonathan M Davis wrote:
 On Tuesday, May 21, 2013 00:51:51 Idan Arye wrote:
 Anyways, do you happen to know where we can get a proper
 indentation for D under Vim?
What do you mean by proper indentantion? I just set tabstop and shiftwidth to 4 and then turn on cindent. Is there something that that doesn't cover? I'm probably just so used to how that works that I have no clue what you're missing. - Jonathan M Davis
Not sure exactly what he has in mind. I know 'gd' and 'gD' fail most often (goto definition) Ctags probably could get a patch pushed upstream, but since I'm not using it I don't know if there is still something wrong. Other than that, I don't know what would be missing.
May 20 2013
next sibling parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Tuesday, 21 May 2013 at 00:39:48 UTC, Jesse Phillips wrote:
 On Tuesday, 21 May 2013 at 00:17:56 UTC, Jonathan M Davis wrote:
 On Tuesday, May 21, 2013 00:51:51 Idan Arye wrote:
 Anyways, do you happen to know where we can get a proper
 indentation for D under Vim?
What do you mean by proper indentantion? I just set tabstop and shiftwidth to 4 and then turn on cindent. Is there something that that doesn't cover? I'm probably just so used to how that works that I have no clue what you're missing. - Jonathan M Davis
Not sure exactly what he has in mind. I know 'gd' and 'gD' fail most often (goto definition) Ctags probably could get a patch pushed upstream, but since I'm not using it I don't know if there is still something wrong. Other than that, I don't know what would be missing.
Some examples: void main(){ /+ Comment +/ } When applying indentation, turns to void main(){ /+ Comment +/ } Also: void main(){ foo([ 1, 2, 3, ], [ 4, 5, 6, ]); } turns to: void main(){ foo([ 1, 2, 3, ], [ 4, 5, 6, ]); }
May 20 2013
parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Tuesday, 21 May 2013 at 00:54:58 UTC, Idan Arye wrote:
 On Tuesday, May 21, 2013 00:51:51 Idan Arye wrote:
 Anyways, do you happen to know where we can get a proper
 indentation for D under Vim?
Some examples:
Ah yes, formatter. This is handled by their internal c-indenting function. These may be acceptable corrections to include there, but nothing D specific is likely to make it in. (:help =) You can set 'equalprg' to any external program you wish...
May 20 2013
prev sibling parent reply "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Tuesday, May 21, 2013 02:39:48 Jesse Phillips wrote:
 I know 'gd' and 'gD' fail most often (goto definition)
 Ctags probably could get a patch pushed upstream, but since I'm
 not using it I don't know if there is still something wrong.
I gave up on ctags ages ago with just C++. I wouldn't even attempt to use it with D. It's way too primitive to be worth anything IMHO. Among othe things, it would have to actual understand namespaces (or modules or whatever) and overloads, and it doesn't. You need something that actually understands the language. - Jonathan M Davis
May 20 2013
parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Tuesday, 21 May 2013 at 01:08:08 UTC, Jonathan M Davis wrote:
 On Tuesday, May 21, 2013 02:39:48 Jesse Phillips wrote:
 I know 'gd' and 'gD' fail most often (goto definition)
 Ctags probably could get a patch pushed upstream, but since I'm
 not using it I don't know if there is still something wrong.
I gave up on ctags ages ago with just C++. I wouldn't even attempt to use it with D. It's way too primitive to be worth anything IMHO. Among othe things, it would have to actual understand namespaces (or modules or whatever) and overloads, and it doesn't. You need something that actually understands the language. - Jonathan M Davis
Take a look at DScanner - https://github.com/Hackerpilot/Dscanner It can produce ctags files.
May 20 2013
parent "Brian Schott" <briancschott gmail.com> writes:
On Tuesday, 21 May 2013 at 01:13:13 UTC, Idan Arye wrote:
 Take a look at DScanner - 
 https://github.com/Hackerpilot/Dscanner

 It can produce ctags files.
It also attempts to provide some level of autocomplete for Vim and Textadept. It doesn't work very reliably, so consider it a prototype. I have plans for a replacement soon(tm). On the topic of ctags, I think that what he's referring to is that the ctags format, not the tool, is not sufficient for D.
May 20 2013