Browsing sample code

What technique do you use when browsing sample code?

Let's say that you want to write a plugin for IDEA. You probably have
a few samples that you want to keep on hand during development.
How do you do that? I can think of a number of ways:
a. Open as separate projects.
b. Add as modules to your own project.
c. Add as libraries.
d. Open as File.
e. Use separate Notepad.

I want syntax highlighting and browsing available, which rules out d and e.
Opening as separate project means that I have to configure a project that I
may not be interested in. Also, there's no natural link between my project
and the sample project.
Adding the sample code as a module means that the sample will be built along
with my project. I'm not interested in that.
Adding the sample code as a library requires class files. Also, if I'm not
careful, the sample code will be included in my plugin.

What's the best practice here?

I can imagine a feature where you can add the root of a source tree as
sample code. This sample code should be syntax highlighted and browsable, but
it should not be built. Also, it should not be possible to refer to it from
"real" code.

/Mikael

4 comments


+1

Hello Mikael,

What technique do you use when browsing sample code?

Let's say that you want to write a plugin for IDEA. You probably have
a few samples that you want to keep on hand during development.
How do you do that? I can think of a number of ways:
a. Open as separate projects.
b. Add as modules to your own project.
c. Add as libraries.
d. Open as File.
e. Use separate Notepad.
I want syntax highlighting and browsing available, which rules out d
and e.
Opening as separate project means that I have to configure a project
that I
may not be interested in. Also, there's no natural link between my
project
and the sample project.
Adding the sample code as a module means that the sample will be built
along
with my project. I'm not interested in that.
Adding the sample code as a library requires class files. Also, if I'm
not
careful, the sample code will be included in my plugin.
What's the best practice here?

I can imagine a feature where you can add the root of a source tree as
sample code. This sample code should be syntax highlighted and
browsable, but it should not be built. Also, it should not be possible
to refer to it from "real" code.

/Mikael



0

Sounds like a good plugin.

"Toader Mihai Mihai Claudiu" <mtoader@gmail.com> wrote in message
news:622ede67605938c7e13a4f2fa2de@news.intellij.net...
>

+1

>

Hello Mikael,

>
>> What technique do you use when browsing sample code?
>>
>> Let's say that you want to write a plugin for IDEA. You probably have
>> a few samples that you want to keep on hand during development.
>> How do you do that? I can think of a number of ways:
>> a. Open as separate projects.
>> b. Add as modules to your own project.
>> c. Add as libraries.
>> d. Open as File.
>> e. Use separate Notepad.
>> I want syntax highlighting and browsing available, which rules out d
>> and e.
>> Opening as separate project means that I have to configure a project
>> that I
>> may not be interested in. Also, there's no natural link between my
>> project
>> and the sample project.
>> Adding the sample code as a module means that the sample will be built
>> along
>> with my project. I'm not interested in that.
>> Adding the sample code as a library requires class files. Also, if I'm
>> not
>> careful, the sample code will be included in my plugin.
>> What's the best practice here?
>>
>> I can imagine a feature where you can add the root of a source tree as
>> sample code. This sample code should be syntax highlighted and
>> browsable, but it should not be built. Also, it should not be possible
>> to refer to it from "real" code.
>>
>> /Mikael
>>
>



0


You need a new type of root for the module (like java sources non compilable).
I don't the openapi has the power to enable such a plugin but I might be
wrong. Maybe a custom filtering compiler ?

Sincerely,
ToMiC


Hello Brad,

Sounds like a good plugin.

"Toader Mihai Mihai Claudiu" <mtoader@gmail.com> wrote in message
news:622ede67605938c7e13a4f2fa2de@news.intellij.net...

>> +1
>>
>> Hello Mikael,
>>
>>> What technique do you use when browsing sample code?
>>>
>>> Let's say that you want to write a plugin for IDEA. You probably
>>> have
>>> a few samples that you want to keep on hand during development.
>>> How do you do that? I can think of a number of ways:
>>> a. Open as separate projects.
>>> b. Add as modules to your own project.
>>> c. Add as libraries.
>>> d. Open as File.
>>> e. Use separate Notepad.
>>> I want syntax highlighting and browsing available, which rules out d
>>> and e.
>>> Opening as separate project means that I have to configure a project
>>> that I
>>> may not be interested in. Also, there's no natural link between my
>>> project
>>> and the sample project.
>>> Adding the sample code as a module means that the sample will be
>>> built
>>> along
>>> with my project. I'm not interested in that.
>>> Adding the sample code as a library requires class files. Also, if
>>> I'm
>>> not
>>> careful, the sample code will be included in my plugin.
>>> What's the best practice here?
>>> I can imagine a feature where you can add the root of a source tree
>>> as sample code. This sample code should be syntax highlighted and
>>> browsable, but it should not be built. Also, it should not be
>>> possible to refer to it from "real" code.
>>>
>>> /Mikael
>>>


0

I've the same need for browsing sample code that shouldn't be part of my project's source. Any hints on how to do this with IntelliJ IDEA would be much appreciated.

0

Please sign in to leave a comment.