I'm looking to make a "Code" editor for Visual Basic.
I just wondered how I would achieve the Syntax Highlighting with most editors use.
Well, I'd start by subclassing the RichTextBox
RichTextBox gives you the ability to colour text, change font, etc. Your class could then implement other features like line numbers, intellisense, showing compile-time exceptions, etc...
That said, to get a good one, you're going to have to made a lot of changes - and most likely tie it in to a compiler or custom parser as well as (presumably) all the other stuff that goes along with a code editor.
Related
Is there a text editor that will let me shade certain code blocks with specific colors so I can easily find them later? Bookmarks are great, but I also wanted to shade with the same color all code blocks which are somehow related to each other.
and
When my current text editors autocreate curly braces or parentheses for me and I type what I want in between them, are there any that let me either jump to the end of the line to put a semicolon there, or "return" to type the next line, or do I always have to use the arrow key to get out of the curly braces? Perhaps there is a shortcut I'm missing?
I think about every code editor, including Notepad++, has bookmarks. If you're looking for a more complete IDE, it probably depends on the language you're using. For .NET languages that is Visual Studio, but you probably would have known that. For PHP, Javascript and HTML/CSS, you can use Netbeans for PHP. Netbeans is also available for Java. It is a rich editor, and I think one of the best free general purpose IDE's available.
Marking pieces of code in colors is unknown to me. I've never seen an editor that supports this. You would also need a project in which to store the start and end points of these blocks, unless you would save them as comments or so in the file itself.
Visual Studio knows regions which you can define by a start tag and an end tag. You can collapse and unfold an entire region at once, making it quite easy to navigate through larger files.
But these regions are actually part of the code file, so you cannot use this for any file, because those region markers will probably make the file invalid.
I'm still wondering why any other shortcut key would be easier or more convenient than 'arrow down'..
I am very new to Cocoa and Objective C so please forgive me if this is a dumb or obvious question. I'd be very grateful just for pointers to the right classes to read the documentation for or any existing web resources that will help me figure this out. I am very much willing to do the hard work figuring this out if I can find some suitable resources to point me in the right direction.
I am writing an app that, essentially, will contain a text view into which a user will enter multi-line text. This will then be parsed (I'm thinking of using an NSScanner or, maybe, the ready-made stuff in ParseKit) to extract and tokenise certain words and numerical information which will be stored in a model object.
I think I can figure out the parsing and data-storage stuff. However, I would like the tokenised words and numbers to be highlighted to the user so that they can easily see them, change them and also have a contextual menu (with a disclosure triangle) to perform actions such as ignoring them. Ideally this would look a lot like the way Xcode deals with class names (underlining them with dashed line, giving them a menu etc).
I've had a look at NSTokenField but this seems to be suited most to single-line fields and the big blue tokens are a bit too visually disruptive for what I want. Also, the docs seem to suggest that using the plain text style only allows one token per field so I couldn't mix that with another style to get the effect that I'm after.
I've also had a look at text attachment attributes but I can't quite conceptualise whether they would be the right way to go. So, my questions are:
What is the best way to tokenise only some text within a multi-line text view?
Is it possible to implement a custom visual style for the tokens? Can I do this with existing classes or do I need to create my own?
Watch the WWDC sessions on the Cocoa text system. The class you want to understand is NSLayoutManager.
I am making an PM system, now I am to where you are going to type the PM.
I dont know really what to use, I don't want to use an normal fugly text field, as theres much nicer stuff out there.
Ive seen those auto expand textfields, that expands more you write? What is this called? Then there's this facebook have, which i also like. And then i have seen this "CKEdtior" stuff, which also seems pretty cool (but i wonder how the output from the CKeditor look like if you use bold, italic, etc..)
Which should I get? What i wish is nice, simple & effective.
maybe this is what you are looking for!
Depends on if you want to allow the user to put in stylized text like bold, italic, links etc. If thats the case there are many editors out there that will turn a stock text area into a full featured editor or even a limited editor. All the below editor return formatted HTML text. What you do with it is up to your app.
Try these if you want a word like editor:
xinha.webfactional.com
tinymce.moxiecode.com
ckeditor.com
www.dhtmlx.com/docs/products/dhtmlxEditor/index.shtml
I'm thinking of developing a more efficient version of the Rich Text format but I need to know a little about Syntax Highlighting and Syntax Extraction.
Like when reading the file, read all the {Property Boxes} and use them in a RichTextBox.
Ex:
{C=0000FF}Hello world!{/C}
Prints "Hello world!" in red.
This would also be good to figure out because I am also building acode editor for a very simple version of Python and color codded text would make things easier and seems pretty standard.
There's a codeproject article about this called Syntax highlighting textbox written in C# which might give you some pointers.
And in case you're going to use a RichTextBox I'd suggest this blog post Some RichTextBox tricks .
It might be worth trying to get hold of the book Dissecting a C# Application: Inside SharpDevelop which has a chapter called Chapter 9: Syntax Highlighting (quite old book but might be able to get a second hand copy).
I'm looking for something like CSS for code. Does it exist either in an IDE, or as a plugin?
The compiler often doesn't care how many more spaces or tabs or newlines you have between tokens in your code, but people do care.
I want to specify in my "style sheet" that braces always live on a seperate line, commas are always followed by spaces, and spaces always surround operators.
Somebody else could then take my code and in their style sheet, specify that no unnecessary spaces should be visible, braces should always be on the same line as their predecessor, and functions should always be separated by 3 line breaks. But the code itself should not actually change.
Is there such a tool?
I don't think such a thing exists, the best solution is to have a custom style for local coding (most IDE's allow this) and then use a tool to reformat your source code (like Jalopy for Java) when you commit it centrally.
That way you have something that's common centrally, but can still style how you want locally.
I don't know of any tool that can arbitrarily apply a style to code without actually modifying the text itself. Since you need to edit the code, that seems impractical.
This is called code formatting and if you google "code formatter" and your language of choice you should get a list of available options.
Try some eclipse based IDE (Aptana) or eclipse itsefl and and from there you can configure how the formatting works :)