Home

Licence


CS-Script.Npp - CS-Script tools for Notepad++

Notepad++ plugins suite. 

CS-Script Intellisense  - C# intellisense featires of the CS-Script plugin for Notepad++


Features
  • CLR Type members auto-completion. (Ctrl+Space or type '.')
 
  • Show Member info
    The info is implemented as a non-interactive tooltip. It pops up by rolling mouse over the C# syntax token. It cannot be triggered by any shortcut.

 

  • Show Method Info (overloads) popup while typing. 
    The info is implemented as a interactive tooltip: you can iterate through method overloads with the up and down buttons .
    Triggered either automatically by typing '(' or by  F6 shortcut. For both triggers to work it is required that caret should be further the method opening bracket.
    If this condition is not met the info will not popup.  The info will also not popup if the method information cannot be obtained (e.g. becuse of compiling error).

 

  • Adding missing 'usings'.  (Ctrl+.)

  • Go to definition (F12)
    - in C# source code
    - in the reconstructed referenced assembly.


  • Formatting C# source code (Ctrl+F82)
    Before

    //css_ref ..\..\..\WixSharp\Output\WixSharp.dll;

        using IO=System.IO;
    using System;
    using             WixSharp;

                 class Script
    {
        [STAThread]     
        static public void Main(string[] args)



    {
            
            
            string pluginFile = IO.Path.GetFullPath(        @"Plugins\CSScriptIntellisense.dll");
            Version version = System.Reflection.Assembly.ReflectionOnlyLoadFrom(pluginFile              ).GetName().Version;
            
            
            
            
            Compiler.WixLocation           =               @"..\..\..\WixSharp\Main\WixSharp.Samples\Wix_bin\bin";
            
            Project project =
                new Project("C# Intellisense for Notepad++",
                    new Dir(@"%ProgramFiles%\Notepad++\Plugins",
                        new File(@"Plugins\CSScriptIntellisense.dll"),
                        new Dir("CSharpIntellisense",
                            new File(     @"Plugins\CSharpIntellisense\CSScriptLibrary.dll"),
                            new File(@"Plugins\CSharpIntellisense\Mono.Cecil.dll"),
                            new File(   @"Plugins\CSharpIntellisense\ICSharpCode.NRefactory.CSharp.dll"),
                            new File(@"Plugins\CSharpIntellisense\ICSharpCode.NRefactory.dll"))));

                                        project.GUID = new Guid("6f930b47-2277-435d-9095-1861ba25889b");
            
            project.Version = version;
            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.LicenceFile = "license.rtf";

            Compiler.BuildMsi(project, "CSScriptIntellisesne.msi");
    }
    }
    After
    //css_ref ..\..\..\WixSharp\Output\WixSharp.dll;
    using IO=System.IO;
    using System;
    using WixSharp;

    class Script
    {
        [STAThread
        static public void Main(string[] args)
        {
            string pluginFile = IO.Path.GetFullPath(@"Plugins\CSScriptIntellisense.dll");
            Version version = System.Reflection.Assembly.ReflectionOnlyLoadFrom(pluginFile).GetName().Version;
            
            Compiler.WixLocation = @"..\..\..\WixSharp\Main\WixSharp.Samples\Wix_bin\bin";
            
            Project project =
                new Project("C# Intellisense for Notepad++",
                    new Dir(@"%ProgramFiles%\Notepad++\Plugins",
                        new File(@"Plugins\CSScriptIntellisense.dll"),
                        new Dir("CSharpIntellisense",
                            new File(@"Plugins\CSharpIntellisense\CSScriptLibrary.dll"),
                            new File(@"Plugins\CSharpIntellisense\Mono.Cecil.dll"),
                            new File(@"Plugins\CSharpIntellisense\ICSharpCode.NRefactory.CSharp.dll"),
                            new File(@"Plugins\CSharpIntellisense\ICSharpCode.NRefactory.dll"))));

            project.GUID = new Guid("6f930b47-2277-435d-9095-1861ba25889b");
            
            project.Version = version;
            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.LicenceFile = "license.rtf";

            Compiler.BuildMsi(project, "CSScriptIntellisesne.msi");
        }
    }

System Requirements
'CS-Script Intellisense' requires .NET 4.0 or higher.

Installation
To install plugin unpack the content of the CSScriptIntellisesnse.zip and copy all files from the '<archive>\Plugins' folder in the 'Notepad++\plugins' directory.
It is a cut down version of the CS-Script plugin and it includes only the intellisense specific functionality.

Usage
"CS-Script Intellisense" will display the completion suggestions when the '.' character is typed or the plugin shortcut is pressed. The plugin is bound to "Ctrl+." shortcut by default.

It is possible to invoke C# Intellisense (for .cs files) and Notepad++ native Auto-Completion (for non .cs files) with the same shortcut (Ctrl-Space). In order to do this you need to enable "Use Visual Studio shortcuts" in the menu Plugins->C# Intellisense->Settings.



"CS-Script Intellisense" will also allow resolving and add the missing namespaces (with using statements) in the similar to the way Visual Studio does it.  The plugin is bound to "Ctrl+Shift+." shortcut by default. however if the "Invoke native Auto-Completion for non .cs files" is enabled the "Namespace   resolving is remapped to the more familiar "Ctrl+." shortcut.
 
The intellisense implementation is based on the CS-Script C# source code model. A single .cs file (Notepad++ current document) forms a single-file C# project. The referenced assemblies are resolved automatically from the "using <namespace>;" clauses. The CS-Script //css_ref (or //css_reference) directives can be used to reference assemblies explicitly.

Extra C# files can also be added to the logical C# project with the //css_inc (or //css_include) directives.

The information about all CS-Script directives (~8 in total) can be found here: http://www.csscript.net/help/Directives.html

The majority of the dependency scenarios can be handled by just two directives:  //css_inc and //css_ref. And in many case there is even no need for any CS-Script directives at all as a plain vanila C# file is ususally compatible with the CS-Script intellisense model.   
     
The following are the samples of how to use the CS-Script directives:

Including the C# file math.cs containing the Math class definition
//css_inc math.cs; 
using
 System;

class Script
{
static public void Main(string [] args)
{
Console.WriteLine(Math.Calculator.Add(1,2));
}
}
Referencing the math.dll assembly containing the Math class implementation
//css_ref math.dll; 
using System;

class
 Script
{
    static public void Main(string [] args)
    {
        Console.WriteLine(Math.Calculator.Add(1,2));
    }
}
  
NOTE: All CS-Script directives and 'using' clauses are processed on the file opening. Thus if the new directive or 'using' clauses added to the "current document" you may want to re-generate the intellisense data with the menu 'Plugins->C# Intellisense->Re-analyse Current Document'.

 

Support
Please send your feedback and problem reports to CS-Script.Npp support


Copyright (C) 2013 Oleg Shilo

Donation