Re: Code snippets

2016-01-18 Thread Geoffrey Huntley
You could make a http://sidewaffle.com/ plugin for your snippets but that
won't help you with the versioning across projects issue once they are in
your code-base.

On 19 January 2016 at 10:54, Greg Keogh  wrote:

> example. It will check out whole files. As whole files, your snippets
>> will need to be complete C# source files, which means classes (whole
>> or partial, but classes nonetheless), not isolated methods.
>>
>
> Nah, I want text "snippets" not classes
>
> can forget about reliable IntelliSense. Personally, I would not go
>> down this splicing route unless both Visual Studio and csc.exe had
>> first-class support for it. For now, snippet files with static partial
>>
>
> If I could write a VS extension then it would all be first-class, but
> that's too hard for now. I think I'll drop this idea until a future long
> weekend.
>
> *GK*
>


Re: Code snippets

2016-01-18 Thread Thomas Koster
On 19 January 2016 at 09:55, Geoffrey Huntley  wrote:
> With the right effort up front it becomes incredibly simple to ship a single
> library as a NuGet package. It can be templated and automated, I have my own
> yeoman generator just for doing exactly this for Xamarin PCLs.

Getting OT... Yes, I spent this effort too, but then yesterday
nuget.exe just updated itself without my permission to a new *major*
version, which is incompatible by definition, and now all my beautiful
scripts are broken. This will waste hours. Next time I should remember
to yank out my network cable and put my laptop in flight mode before
using it. Seriously, what were they thinking?!

NuGet "satisfies" a genuine need, but it's terrible software and I
can't stand it. Unfortunately it faces no credible competition.

--
Thomas Koster


Re: Code snippets

2016-01-18 Thread Thomas Koster
On 19 January 2016 at 10:54, Greg Keogh  wrote:
>> example. It will check out whole files. As whole files, your snippets
>> will need to be complete C# source files, which means classes (whole
>> or partial, but classes nonetheless), not isolated methods.
>
> Nah, I want text "snippets" not classes
>
>> can forget about reliable IntelliSense. Personally, I would not go
>> down this splicing route unless both Visual Studio and csc.exe had
>> first-class support for it. For now, snippet files with static partial
>
> If I could write a VS extension then it would all be first-class, but that's
> too hard for now. I think I'll drop this idea until a future long weekend.

Unfortunately, a VS extension will not help you if you build from the
command line. (Neither will T4 for that matter, unless you specially
craft your templates and your csproj files for this.)

--
Thomas


Re: Code snippets

2016-01-18 Thread Greg Keogh
>
> example. It will check out whole files. As whole files, your snippets
> will need to be complete C# source files, which means classes (whole
> or partial, but classes nonetheless), not isolated methods.
>

Nah, I want text "snippets" not classes

can forget about reliable IntelliSense. Personally, I would not go
> down this splicing route unless both Visual Studio and csc.exe had
> first-class support for it. For now, snippet files with static partial
>

If I could write a VS extension then it would all be first-class, but
that's too hard for now. I think I'll drop this idea until a future long
weekend.

*GK*


Re: Code snippets

2016-01-18 Thread Thomas Koster
Greg,

On 18 January 2016 at 22:58, Greg Keogh  wrote:
> Folks, I'm looking for a way of managing snippets of code that I want to
> include in multiple unrelated projects. I want them to behave like little
> Nuget packages of source code, so when I update snippets in one project they
> will be recognised as out-dated when I open other projects using them.

On 19 January 2016 at 07:19, David Smith  wrote:
> Could you use your version control software to do this?
>
> SVN has externals & Git has  submodules.  Perhaps these mechanisms could do
> what you want?

On 19 January 2016 at 09:17, Greg Keogh  wrote:
> Hi guys, I'm pretty sure I want this "thing" to work at the source code
> level, not at the binary reference level. I said I could put all the
> snippets in DLLs, but I would finish up with dozens of them, each contain
> maybe only 10 lines of code (I have my own local Nuget package source for
> testing).
>
> This mention of SVN externals and Git modules sounds like it's heading in
> the right direction. I personally avoid Git (that's another story), but I a
> quick search about Mercurial "externals" or "subreprositories" shows a few
> confusing overviews that might clarify it if works the way I want. I'll
> report if I find anything useful. It'd be great if you could something like
> this, but this is where I suspect a VS extensions would be required to
> implement it.
>
> #region Snippet: My Snazzy Snippet
> :
> // code would be "included" here
> :
> #endregion

The subrepos/externals feature of your VCS should do mostly what you
want, but it will not splice snippets into existing files as in your
example. It will check out whole files. As whole files, your snippets
will need to be complete C# source files, which means classes (whole
or partial, but classes nonetheless), not isolated methods.

To splice snippets into existing sources, you could use T4 "@include",
or you could program msbuild to use a preprocessor. Either way, you
can forget about reliable IntelliSense. Personally, I would not go
down this splicing route unless both Visual Studio and csc.exe had
first-class support for it. For now, snippet files with static partial
classes that you can add "As Link" from the subrepo should be the
simplest, safest way.

--
Thomas Koster


Re: Code snippets

2016-01-18 Thread Geoffrey Huntley
> But I would finish up with dozens of them, each contain maybe only 10
lines of code.

I don't see a anything wrong with that, we were discussing this exact thing
this morning in the ReactiveUI slack room.

The ReactiveExtensions NuGet package is considered 'bloated'  and
absolutely *hate* how many references it pulls in even though combined file
size is less than 500kb.

It's 100% this weird psychological thing.

With the right effort up front it becomes incredibly simple to ship a
single library as a NuGet package. It can be templated and automated, I
have my own yeoman generator just for doing exactly this for Xamarin PCLs.

On Tue, Jan 19, 2016, 9:40 AM Nathan Fisher 
wrote:

> Nuget can be used to include just code files, all the javascript, css and
> html nuget packages would fit into that category.
>
> Regards
> Nathan
>
> Date: Tue, 19 Jan 2016 09:17:38 +1100
> From: Greg Keogh 
> Subject: Re: Code snippets
> To: ozDotNet 
> Message-ID:
> <
> cabdhbw2kkwrgkgknyv9fefyvqfaynyz9sr3nxois5v8ga2c...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi guys, I'm pretty sure I want this "thing" to work at the source code
> level, not at the binary reference level. I said I could put all the
> snippets in DLLs, but I would finish up with dozens of them, each contain
> maybe only 10 lines of code (I have my own local Nuget package source for
> testing).
>
> This mention of SVN externals and Git modules sounds like it's heading in
> the right direction. I personally avoid Git (that's another story), but I a
> quick search about Mercurial "externals" or "subreprositories" shows a few
> confusing overviews <
> http://www.fogcreek.com/kiln/training/using-mercurial-subrepositories/>
> that might clarify it if works the way I want. I'll report if I find
> anything useful. It'd be great if you could something like this, but this
> is where I suspect a VS extensions would be required to implement it.
>
> #region Snippet: My Snazzy Snippet
> :
> // code would be "included" here
> :
> #endregion
>
> *GK*
>
>
>


Re: Code snippets

2016-01-18 Thread Greg Keogh
>
> Nuget can be used to include just code files


Yeah. You're right. D'oh! ... I forgot. You can put anything into Nuget
packages so long as you have the zip structure correct and set the
manifest. I had the preconception stuck in my head that Nuget and binaries
go together (which they usually do). Thanks for reminding me of this.

Although, this is still to heavy-handed for my needs. I could finish up
with dozens of Nuget packages each containing only 10 lines of code, and
I've have to keep packing and pushing them as they changed. I'd still
prefer something that happens at the source/text level.

*GK*


Re: Code snippets

2016-01-18 Thread Nathan Fisher
Nuget can be used to include just code files, all the javascript, css and html 
nuget packages would fit into that category.

Regards
Nathan

Date: Tue, 19 Jan 2016 09:17:38 +1100
From: Greg Keogh 
Subject: Re: Code snippets
To: ozDotNet 
Message-ID:

Content-Type: text/plain; charset="utf-8"

Hi guys, I'm pretty sure I want this "thing" to work at the source code level, 
not at the binary reference level. I said I could put all the snippets in DLLs, 
but I would finish up with dozens of them, each contain maybe only 10 lines of 
code (I have my own local Nuget package source for testing).

This mention of SVN externals and Git modules sounds like it's heading in the 
right direction. I personally avoid Git (that's another story), but I a quick 
search about Mercurial "externals" or "subreprositories" shows a few confusing 
overviews 
<http://www.fogcreek.com/kiln/training/using-mercurial-subrepositories/>
that might clarify it if works the way I want. I'll report if I find anything 
useful. It'd be great if you could something like this, but this is where I 
suspect a VS extensions would be required to implement it.

#region Snippet: My Snazzy Snippet
:
// code would be "included" here
:
#endregion

*GK*




Re: Code snippets

2016-01-18 Thread Greg Keogh
>
> https://en.wikipedia.org/wiki/Unix_philosophy
> Do one thing, do it well.
>

But make it as difficult as possible.


Re: Code snippets

2016-01-18 Thread Greg Keogh
Hi guys, I'm pretty sure I want this "thing" to work at the source code
level, not at the binary reference level. I said I could put all the
snippets in DLLs, but I would finish up with dozens of them, each contain
maybe only 10 lines of code (I have my own local Nuget package source for
testing).

This mention of SVN externals and Git modules sounds like it's heading in
the right direction. I personally avoid Git (that's another story), but I a
quick search about Mercurial "externals" or "subreprositories" shows a few
confusing overviews

that might clarify it if works the way I want. I'll report if I find
anything useful. It'd be great if you could something like this, but this
is where I suspect a VS extensions would be required to implement it.

#region Snippet: My Snazzy Snippet
:
// code would be "included" here
:
#endregion

*GK*

On 19 January 2016 at 07:19, David Smith  wrote:

> Hi Greg,
>
>
>
> Could you use your version control software to do this?
>
> SVN has externals & Git has  submodules.  Perhaps these mechanisms could
> do what you want?
>
>
>
> David
>
>
>
> *From:* ozdotnet-boun...@ozdotnet.com [mailto:
> ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Greg Keogh
> *Sent:* Tuesday, 19 January 2016 12:58 a.m.
> *To:* ozDotNet 
> *Subject:* Code snippets
>
>
>
> Folks, I'm looking for a way of managing snippets of code that I want to
> include in multiple unrelated projects. I want them to behave like little
> Nuget packages of source code, so when I update snippets in one project
> they will be recognised as out-dated when I open other projects using them.
>
>
>
> You can get this sharing effect by adding files "as link" in multiple
> projects, but then the projects get mixed up with your local file system.
> Putting the snippets in a utility DLL is technically correct, but far too
> heavy handed for me.
>
>
>
> Is anyone aware of some facility that does what I want? A VS plugin would
> probably be the way to go, but they're really taxing and specialised to
> write. Maybe there are other ways.
>
>
>
> *Greg K*
>


Re: Code snippets

2016-01-18 Thread Geoffrey Huntley
Always be creating NuGet packages (and open sourcing), no matter how small
the code snippet is.

https://en.wikipedia.org/wiki/Unix_philosophy

Do one thing, do it well.

Some of the best libraries in npmjs are less than 50 lines long.

On 19 January 2016 at 07:41, Nic Roche  wrote:

> Hi,
>
> You can build and host (on your network as a file share) your own nuget
> packages.
>
> This can be done from your build tool-chain. The local "repository" can
> also be setup as the default source for nuget.
>
> Nic
>
> --
> From: dav...@nzcity.co.nz
> To: ozdotnet@ozdotnet.com
> Subject: RE: Code snippets
> Date: Mon, 18 Jan 2016 20:19:37 +
>
>
> Hi Greg,
>
>
>
> Could you use your version control software to do this?
>
> SVN has externals & Git has  submodules.  Perhaps these mechanisms could
> do what you want?
>
>
>
> David
>
>
>
> *From:* ozdotnet-boun...@ozdotnet.com [mailto:
> ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Greg Keogh
> *Sent:* Tuesday, 19 January 2016 12:58 a.m.
> *To:* ozDotNet 
> *Subject:* Code snippets
>
>
>
> Folks, I'm looking for a way of managing snippets of code that I want to
> include in multiple unrelated projects. I want them to behave like little
> Nuget packages of source code, so when I update snippets in one project
> they will be recognised as out-dated when I open other projects using them.
>
>
>
> You can get this sharing effect by adding files "as link" in multiple
> projects, but then the projects get mixed up with your local file system.
> Putting the snippets in a utility DLL is technically correct, but far too
> heavy handed for me.
>
>
>
> Is anyone aware of some facility that does what I want? A VS plugin would
> probably be the way to go, but they're really taxing and specialised to
> write. Maybe there are other ways.
>
>
>
> *Greg K*
>


RE: Code snippets

2016-01-18 Thread Nic Roche
Hi,
You can build and host (on your network as a file share) your own nuget 
packages.
This can be done from your build tool-chain. The local "repository" can also be 
setup as the default source for nuget.
Nic

From: dav...@nzcity.co.nz
To: ozdotnet@ozdotnet.com
Subject: RE: Code snippets
Date: Mon, 18 Jan 2016 20:19:37 +









Hi Greg,
 
Could you use your version control software to do this? 

SVN has externals & Git has  submodules.  Perhaps these mechanisms could do 
what you want?
 
David
 
From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Greg Keogh

Sent: Tuesday, 19 January 2016 12:58 a.m.

To: ozDotNet 

Subject: Code snippets
 


Folks, I'm looking for a way of managing snippets of code that I want to 
include in multiple unrelated projects. I want them to behave like little Nuget 
packages of source code, so when I update snippets in one project they will be 
recognised
 as out-dated when I open other projects using them.


 


You can get this sharing effect by adding files "as link" in multiple projects, 
but then the projects get mixed up with your local file system. Putting the 
snippets in a utility DLL is technically correct, but far too heavy handed for 
me.


 


Is anyone aware of some facility that does what I want? A VS plugin would 
probably be the way to go, but they're really taxing and specialised to write. 
Maybe there are other ways.


 


Greg K


  

RE: Code snippets

2016-01-18 Thread David Smith
Hi Greg,

Could you use your version control software to do this?
SVN has externals & Git has  submodules.  Perhaps these mechanisms could do 
what you want?

David

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Greg Keogh
Sent: Tuesday, 19 January 2016 12:58 a.m.
To: ozDotNet 
Subject: Code snippets

Folks, I'm looking for a way of managing snippets of code that I want to 
include in multiple unrelated projects. I want them to behave like little Nuget 
packages of source code, so when I update snippets in one project they will be 
recognised as out-dated when I open other projects using them.

You can get this sharing effect by adding files "as link" in multiple projects, 
but then the projects get mixed up with your local file system. Putting the 
snippets in a utility DLL is technically correct, but far too heavy handed for 
me.

Is anyone aware of some facility that does what I want? A VS plugin would 
probably be the way to go, but they're really taxing and specialised to write. 
Maybe there are other ways.

Greg K