 |
|
 |
Suggestions:
Make your codeTextBox think like a compiler. Once in a while, look for /*, and highlight green until */.
If it finds a #region, just highlight it!
|
|
|
|
 |
|
 |
Save many time, thanx!
how can I put the icons in the intellisense?
Best regards,
Ulli
|
|
|
|
 |
|
 |
Good attempt, but not very useful since it takes forever to highlight a bunch of keywords if something is pasted into the text box.
|
|
|
|
 |
|
 |
Hi
I am tring to add the .dll to a Visual Basic .NET project. When i add it to the resources and recompile my project, it doesnt add anything to the toolbox or give me any new code.
Ideas?
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
It's not 100% like Visual Studio.
If i hit "." in the intellisenseBox the source code isn't completing. The hotkey strg + space doesn't work everytime and not clean.
To The sourceCode:
i only have took a overlook, there are too many regions in my oppinion there are to many regions.
Good work at all
Sorry for my bad english
|
|
|
|
 |
|
 |
I found this very useful. Thank you for your work.
|
|
|
|
 |
|
 |
How to run Tomas code in Silverlight ? SL4 has richtextbox so this may be possible. Or any other idew how to implement script editor is Silverlight client ?
Andrus.
Andrus
|
|
|
|
 |
|
 |
I found your implementation very clever and you obviously took extra time to format the code to make it very readable and understandable. I was able to quickly adapt the code to a different usage, much simpler, actually, as I merely wished to present to the user refined lists of some rather nasty-to-type identifiers for an odd database formula editor.
I think your use of the TreeView was a particularly clever idea. May not be the datastructure one would pick just for a data structure, but having it as a TreeView sure makes it easy to view and edit with just a little more code. Well done and thanks!
|
|
|
|
 |
|
 |
First of all, this is extremely cool - I appreciate your efforts and this is fantastic for my project!
I have a small problem though - I want to highlight every instances of hexadecimal numbers from 00-FFFFFF (meaning every hex number from 00-FFFFFF which are 2 digit, 4 digit or 6 digit, NOT 1, 3 or 5 digit (like, highlight 01, 0001 and 000001 but NOT 1, 001 or 00001). If I write this manually, it will take be time-consuming, it would reduce the performance of the program too. What would be the best way to do this?
Oh, I forgot to mention. I want #$ to be written before the numbers. Like #$01, not just 01. I tried doing this manually but the # and $ won't get recognised. How can I fix this?
modified on Thursday, December 17, 2009 10:20 AM
|
|
|
|
 |
|
 |
when parsing a hundreds of lines file is very slow
|
|
|
|
 |
|
 |
It is not difficult to adapt this to only parse the information that is presented on-screen. No point in "syntax highlighting" anything that isn't presently in the editor view.
|
|
|
|
 |
|
 |
Code contains one pinvoke call:
[DllImport("user32.dll", SetLastError = true)]
public static extern bool PostMessage(
IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam );
so it will not run under MONO in Linux.
How to fix this so this can be used under MONO also ?
Also, some hunderd lines of code take 5-10 seconds to load at startuo.
How to speed it up ?
Andrus
|
|
|
|
 |
|
 |
PostMessage is used to send a message to another window, usually a non-.NET one. However this code window shouldn't need to do that, so it should be possible to fix it so this call isn't needed. You'd have to look at the source code to figure out where this call is used and why, and then you can figure out an alternative.
|
|
|
|
 |
|
 |
The pinvoke is easily removed. Tomas had some specific key handling he wished to put in there, but it is not necessary. I was able to quickly revise it to eliminate the need for PostMessage(). It worked fine with the OnKeyDown() override and I was able to quickly change other logic by using and OnTextChanged() override in the RichTextBox derivative class that simplified the logic further. Both should be supported in Mono. Tomas' code is very well laid out, simple to follow, and thus simple to modify. I had my Intellisense and syntax highlighting done using his code within an hour with pinvoke gone, the ImageListBox changed to a simple ListBox, and context sensitive switching between different keyword lists. Just work with the code a little!
|
|
|
|
 |
|
 |
Can you provide an alternative solution (.sln) file?
|
|
|
|
 |
|
 |
I would like to see a VS2005 solution file also.....looks like a great piece of code!
Thanks
|
|
|
|
 |
|
 |
I don't have Visual Studio 2005 installed at the moment, but as I can remember there's no .NET 3.0 or .NET 3.5 specific code in the solution.
Just create a VS2005 solution, grab the files into, and it should work.
Tamas
|
|
|
|
 |
|
 |
When large block of code is pasted in to box, CodeTextBox blinks long time.
How to remove this blikning ?
Andrus
|
|
|
|
 |
|
 |
Hi Andrus,
I know about that issue, but unfortunately haven't found a reasonable solution yet.
Maybe it can be solved with some Win32 API invokes (WM_SetRedraw) as I've seen in another solution, but that means, it won't work on Mono...
However,
if you have another working solution for this, please le me know!
Regards,
Tamas
|
|
|
|
 |
|
 |
Thank you for reply.
Mini-csarplab earlier version highlighter which I currently use pastes without flashing. It uses secondary invisible RichTextBox as buffer for this. This does not require pinvokes.
Maybe this method can be used.
I tested it in MONO SVN and found that sometimes MONO crashes
with expeption.
Also I found that colors are incorrect in MONO.
It may be worth to create simple code to reproduce those issues and post them to MONO buglist to they can be fixed.
I'm also interested to highlight SQL syntax. How to add this ? Manoli highlighter uses class below to define this. How to use this class or some other SQL syntax definition?
#region Copyright © 2001-2003 Jean-Claude Manoli [jc@manoli.net]
#endregion
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
namespace Manoli.Utils.CSharpFormat
{
class TsqlFormat : CodeFormat
{
protected override string CommentRegEx
{
get
{
return @"(?:--\s).*?(?=\r|\n)";
}
}
protected override string StringRegEx
{
get
{
return @"''|'.*?'";
}
}
public override bool CaseSensitive
{
get { return false; }
}
protected override string Keywords
{
get
{
return "absolute action ada add admin after aggregate "
+ "alias all allocate alter and any are array as asc "
+ "assertion at authorization avg backup before begin "
+ "between binary bit bit_length blob boolean both breadth "
+ "break browse bulk by call cascade cascaded case cast "
+ "catalog char char_length character character_length "
+ "check checkpoint class clob close clustered coalesce "
+ "collate collation column commit completion compute "
+ "connect connection constraint constraints constructor "
+ "contains containstable continue convert corresponding "
+ "count create cross cube current current_date current_path "
+ "current_role current_time current_timestamp current_user "
+ "cursor cycle data database date day dbcc deallocate dec "
+ "decimal declare default deferrable deferred delete deny "
+ "depth deref desc describe descriptor destroy destructor "
+ "deterministic diagnostics dictionary disconnect disk "
+ "distinct distributed domain double drop dummy dump "
+ "dynamic each else end end-exec equals errlvl escape "
+ "every except exception exec execute exists exit external "
+ "extract false fetch file fillfactor first float for "
+ "foreign fortran found free freetext freetexttable from "
+ "full function general get global go goto grant group "
+ "grouping having holdlock host hour identity identity_insert "
+ "identitycol if ignore immediate in include index indicator "
+ "initialize initially inner inout input insensitive insert "
+ "int integer intersect interval into is isolation iterate "
+ "join key kill language large last lateral leading left "
+ "less level like limit lineno load local localtime localtimestamp "
+ "locator lower map match max min minute modifies modify "
+ "module month names national natural nchar nclob new next "
+ "no nocheck nonclustered none not null nullif numeric object "
+ "octet_length of off offsets old on only open opendatasource "
+ "openquery openrowset openxml operation option or order "
+ "ordinality out outer output over overlaps pad parameter "
+ "parameters partial pascal path percent plan position "
+ "postfix precision prefix preorder prepare preserve "
+ "primary print prior privileges proc procedure "
+ "public raiserror read reads readtext real reconfigure "
+ "recursive ref references referencing relative replication "
+ "restore restrict result return returns revoke right role "
+ "rollback rollup routine row rowcount rowguidcol rows rule "
+ "save savepoint schema scope scroll search second section "
+ "select sequence session session_user set sets setuser "
+ "shutdown size smallint some space specific specifictype "
+ "sql sqlca sqlcode sqlerror sqlexception sqlstate sqlwarning "
+ "start state statement static statistics structure substring "
+ "sum system_user table temporary terminate textsize than then "
+ "time timestamp timezone_hour timezone_minute to top trailing "
+ "tran transaction translate translation treat trigger trim "
+ "true truncate tsequal under union unique unknown unnest "
+ "update updatetext upper usage use user using value values "
+ "varchar variable varying view waitfor when whenever where "
+ "while with without work write writetext year zone";
}
}
protected override string Preprocessors
{
get
{
return @"@@CONNECTIONS @@CPU_BUSY @@CURSOR_ROWS @@DATEFIRST "
+ "@@DBTS @@ERROR @@FETCH_STATUS @@IDENTITY @@IDLE "
+ "@@IO_BUSY @@LANGID @@LANGUAGE @@LOCK_TIMEOUT "
+ "@@MAX_CONNECTIONS @@MAX_PRECISION @@NESTLEVEL @@OPTIONS "
+ "@@PACK_RECEIVED @@PACK_SENT @@PACKET_ERRORS @@PROCID "
+ "@@REMSERVER @@ROWCOUNT @@SERVERNAME @@SERVICENAME @@SPID "
+ "@@TEXTSIZE @@TIMETICKS @@TOTAL_ERRORS @@TOTAL_READ "
+ "@@TOTAL_WRITE @@TRANCOUNT @@VERSION";
}
}
}
}
Andrus
|
|
|
|
 |
|
 |
Hi Andrus,
as I see, this class uses a space-separated list of strings for the words to highlight.
Splitting that strings for space, and addig the result arrays to the proper List collections of CodeTextbox should work.
Unfortunately, this version doesn't support string highlightning, but u can highlight preprocessors with the function list, and u can gain an additional color.
The buffer-richTextbox solution is interesting, but I don't have any idea, how slow it could be because of the duplicate pastes, especially for larger texts...
Regards,
Tamas
|
|
|
|
 |
|
 |
SharpDevelop is LGPL'd open source. It's worth taking a look at.
Quite a few WinForm apps use #develop (SharpDevelop)'s TextEditor, which should give you pretty much of what you need as a syntax highlight editor. It not designed to work with the WinForm designer, though, but using it with just code isn't all that hard.
Other parts of SharpDevelop can be used to implement your own IntelliSense-like functionality.
|
|
|
|
 |
|
 |
I'll also add that you can drop in your own kind of highlighting by implementing your own version of IHighlightingStrategy and plugging it in. If you have a parser you've created with some other parser generation tool, for example, gold parser builder, you can plug it in to the system by wrapping it in an IHighlightingStrategy class.
|
|
|
|
 |