Snippets in VS 2017 RC .... some success ....
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Snippets in VS 2017 RC .... some success ....
Hi guys,
Well, it may not be possible (yet) to add our own snippets - BUT - I feel I am well on my way to be able to easily tell others how to do it when we get the newer versions of the VS 2017 integration.
The free download tool makes it quite easy to be able to ignore the XML script, as these images show :-
and when the snippet is inserted it looks like this :-
and this :-
Oh! the big gotcha seems to be that we need to close and re-open the version of VS 2017 I currently have - then the new snippet shows up.
Here is the folder choice list :-
Oh! - by the way, I am NOT doing this to compete with the #command efforts - just so we know how to do it as we will need other snippets too, and I may even be able to get the snippet to take parameters as well, a bit like the pre-processor approach.
So soon we may even have a choice of three ways, hand code, #command, and also snippet.
Hope this interests ;-0)
Phil.
Wales, UK.
Well, it may not be possible (yet) to add our own snippets - BUT - I feel I am well on my way to be able to easily tell others how to do it when we get the newer versions of the VS 2017 integration.
The free download tool makes it quite easy to be able to ignore the XML script, as these images show :-
and when the snippet is inserted it looks like this :-
and this :-
Oh! the big gotcha seems to be that we need to close and re-open the version of VS 2017 I currently have - then the new snippet shows up.
Here is the folder choice list :-
Oh! - by the way, I am NOT doing this to compete with the #command efforts - just so we know how to do it as we will need other snippets too, and I may even be able to get the snippet to take parameters as well, a bit like the pre-processor approach.
So soon we may even have a choice of three ways, hand code, #command, and also snippet.
Hope this interests ;-0)
Phil.
Wales, UK.
Snippets in VS 2017 RC .... some success ....
Hi Phil,
But I don't think snippets are a solution to the "properties" problem like the preprocessor.
Snippets are inserted in the code and this code is visible and is "clogging" the editor with over and over repeated code.
I agree the in the backgrounbd this code is needed, but I don't like to see more than one readable line of it.
The needed code should be generated in the background (like auto properties generate an invisible variable). If you need to see it for diagnose, it is another thing ( I have looked at Clippers .PPO files very few times).
We have to write less code possible to get things done, and snippets go to the other direction.
Wolfgang
Since I'm using XIDE, I have built my own snippets.So soon we may even have a choice of three ways, hand code, #command, and also snippet.
But I don't think snippets are a solution to the "properties" problem like the preprocessor.
Snippets are inserted in the code and this code is visible and is "clogging" the editor with over and over repeated code.
I agree the in the backgrounbd this code is needed, but I don't like to see more than one readable line of it.
The needed code should be generated in the background (like auto properties generate an invisible variable). If you need to see it for diagnose, it is another thing ( I have looked at Clippers .PPO files very few times).
We have to write less code possible to get things done, and snippets go to the other direction.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Snippets in VS 2017 RC .... some success ....
+1 !
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Snippets in VS 2017 RC .... some success ....
Hi Wolfgang,
I tend to agree with your analysis ;-0)
However, like you I also wish to be able to create and use snippets, but from with VS.
I have a feeling that we may find quite a few nice and useful ways to create and use #commands in our general coding. Maybe we could run a monthly competition - you know, #command of the month award !!!
Is the idea that we can each post our #commands in the Examples part of the public Forum ? So we can copy and paste ?
How easy will it be to have two forms of #command, one with and one without the change Notification method call?
Have a nice day,
Phil.
I tend to agree with your analysis ;-0)
However, like you I also wish to be able to create and use snippets, but from with VS.
I have a feeling that we may find quite a few nice and useful ways to create and use #commands in our general coding. Maybe we could run a monthly competition - you know, #command of the month award !!!
Is the idea that we can each post our #commands in the Examples part of the public Forum ? So we can copy and paste ?
How easy will it be to have two forms of #command, one with and one without the change Notification method call?
Have a nice day,
Phil.
Snippets in VS 2017 RC .... some success ....
Hi Phil,
yes, I agree with you <g>. Sharing #Command snippets is a great idea!
I'm looking forward to the new compiler version where this will be possible.
And even if I don't use the VS monster (sorry, could not resist <g>), I agree that snippets are a very important thing in VS.
Thank to the extension interface in XIDE I was able to build a textblock interface into it, and a textblock like this:
works very well when starting a new class.
Wolfgang
P.S. of course I'm willing to share the source of this plugin (that is far from being finished)
yes, I agree with you <g>. Sharing #Command snippets is a great idea!
I'm looking forward to the new compiler version where this will be possible.
And even if I don't use the VS monster (sorry, could not resist <g>), I agree that snippets are a very important thing in VS.
Thank to the extension interface in XIDE I was able to build a textblock interface into it, and a textblock like this:
Code: Select all
begin namespace {DefaultNamespace}
class {Filename}
end class
end namespace
Wolfgang
P.S. of course I'm willing to share the source of this plugin (that is far from being finished)
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Snippets in VS 2017 RC .... some success ....
Phil,
Copy and paste the #command and add CHANGE NOTIFY. Obviously in the original #command the OnPropertyChanged method need to be removed.
#command PROPERTY <n> AS <t> GETSET <v> =>;
PROPERTY <n> AS <t>;;
GET;;
RETURN SELF:<v>;;
END GET;;
SET;;
IF SELF:<v> <> VALUE
SELF:<v> := VALUE;;
ENDIF;;
END SET;;
END PROPERTY
#command PROPERTY <n> AS <t> GETSET <v> NOTIFY CHANGE =>;
PROPERTY <n> AS <t>;;
GET;;
RETURN SELF:<v>;;
END GET;;
SET;;
IF SELF:<v> <> VALUE;;
SELF:<v> := VALUE;;
SELF:NotifyPropertyChanged(<"n">);;
ENDIF;;
END SET;;
END PROPERTY
Quite easydr philip h. hepburn wrote:Hi Wolfgang,
How easy will it be to have two forms of #command, one with and one without the change Notification method call?
Copy and paste the #command and add CHANGE NOTIFY. Obviously in the original #command the OnPropertyChanged method need to be removed.
#command PROPERTY <n> AS <t> GETSET <v> =>;
PROPERTY <n> AS <t>;;
GET;;
RETURN SELF:<v>;;
END GET;;
SET;;
IF SELF:<v> <> VALUE
SELF:<v> := VALUE;;
ENDIF;;
END SET;;
END PROPERTY
#command PROPERTY <n> AS <t> GETSET <v> NOTIFY CHANGE =>;
PROPERTY <n> AS <t>;;
GET;;
RETURN SELF:<v>;;
END GET;;
SET;;
IF SELF:<v> <> VALUE;;
SELF:<v> := VALUE;;
SELF:NotifyPropertyChanged(<"n">);;
ENDIF;;
END SET;;
END PROPERTY
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Snippets in VS 2017 RC .... some success ....
Ok,
As I hate this webinterface not going to go into the details, but one can easily change the #command to cater for various requirements:
PROPERTY x AS INT GET _x
PROPERTY x AS INT SET _x
PROPERTY x AS INT SET _x NOTIFY CHANGE
Just remove the non-required pieces of the command translation.
As I hate this webinterface not going to go into the details, but one can easily change the #command to cater for various requirements:
PROPERTY x AS INT GET _x
PROPERTY x AS INT SET _x
PROPERTY x AS INT SET _x NOTIFY CHANGE
Just remove the non-required pieces of the command translation.
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Snippets in VS 2017 RC .... some success ....
Jac,
You probably know this already, but the single line syntax for properties is already supported by the compiler:
The GET clause expects an expression, the SET clause expects an expression list.
Robert
You probably know this already, but the single line syntax for properties is already supported by the compiler:
Code: Select all
PROPERTY x AS INT GET _x
PROPERTY x AS INT SET _x := Value
PROPERTY x AS INT GET _x SET _x := Value
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Snippets in VS 2017 RC .... some success ....
Hi Robert,
means this we can use the command preprocessor directive on X# Beta 9?
I have now tried the following code (on a single line):
but it gives the error
Wolfgang
means this we can use the command preprocessor directive on X# Beta 9?
I have now tried the following code (on a single line):
Code: Select all
#command PROPERTY <n> AS <t> GETSET <v> => ; property <n> as <t>;;; get;;; return self:<v>;;; end get;;; set;;; if self:<v> <> value;;; self:<v> := value;;; endif;;; end set;;; end property
Code: Select all
class File1
protect _cCmdProp as string
property myCmdProp as string GETSET _cCmdProp
end class
Code: Select all
error XS9002: Parser: mismatched input 'GETSET' 16,30 File1.prg PropertyTest
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Snippets in VS 2017 RC .... some success ....
Wolfgang,
NO. The single line property syntax is built into the compiler.
You can expect (partial?) UDC support in beta 10.
But in stead of writing (using a UDC)
you can already write (using built in syntax)
This does not need END GET, END SET and END PROPERTY
Robert
NO. The single line property syntax is built into the compiler.
You can expect (partial?) UDC support in beta 10.
But in stead of writing (using a UDC)
Code: Select all
PROPERTY myCmdProp AS String GETSET _cCmdProp
Code: Select all
PROPERTY myCmdProp AS String GET _cCmdProp SET _cCmdProp := Value
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu