Results 1 to 12 of 12

Thread: [RESOLVED] Change Intellisense

  1. #1

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Resolved [RESOLVED] Change Intellisense

    Hello

    I don't know if it's possible, but i want to change some of the defaults intellisenses. For example when i write try and press enter, the IDE puts the catch ex as exception and the end try, but i want that the finally word it's added too.

    Anyone know where to change this behavior?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Change Intellisense

    Do TryCF and then hit tab. That will create a try catch finally block.

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Change Intellisense

    it is not really intellisense, this is more an issue of "autocomplete" where the ide will fill in some of the code.

    You can do this with a snippet though. I have attached the snippet that will do what you want.

    All you need to do is save this file to disk (its a .snippet file, but really its just XML)

    then in Visual Studio you go hit

    Ctrl+K, Ctrl+B

    to bring up the snippet manager. You will see a button for import, so you can click that and select the TryCatchFinallyEndTry.snippet file you downloaded from my attachment.

    The way you use a snippet, is that you type its shortcut in the IDE and then hit TAB (not enter)

    so the shortcut I made for this snippet is TCF (for Try Catch Finally)

    so all you have to do after this snippet is added to your library is type

    TCF {tab}

    and the IDE will insert

    Code:
    Try
    
    Catch ex as exception
    
    Finally
    
    End Try

    *NOTE - I have to zip the .snippet file because the forum doesn't support uploading that extension right now.
    Attached Files Attached Files

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Change Intellisense

    Quote Originally Posted by Negative0 View Post
    Do TryCF and then hit tab. That will create a try catch finally block.
    good to see it was built in. I use a 3rd party snippet editor, and I am not sure what snippets are included with VS, and which ones were included as part of the snippet editor I use. I guess TryCF was a built in one.



    Here is the link if anyone is interested. It is a free app written by a VB MVP

    http://www.codeplex.com/SnippetEditor

  5. #5

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Change Intellisense

    thanks for the replys

    I didn't know what to call to the feature, intellisense, autocomplete, it's a mix of both..

    I allready knew that i could do a snippet to do the job, i just wanted to know if i can change the default behavior of the IDE... i guess not...

    Thanks kleinma for the code of the snippet, i'll gonna change the snippet a little bit, i hope you don't mind

    Solved
    Last edited by mickey_pt; Apr 8th, 2009 at 10:08 AM. Reason: Bad english again...

  6. #6

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Change Intellisense

    Nice app

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Change Intellisense

    nope I dont mind. Its actually the same snippet as the TryCF built in one, just with a hard coding for

    catch ex as exception

    the default behavior made "exception" something slated to be changed after you insert the snippet.

  8. #8
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: [RESOLVED] Change Intellisense

    That's a cool app. And while on the subject of IDE AutoComplete I am wondering if that app can do some property functionality. (Or maybe something similar is built in?)

    Lets say I have a class. Making properties is kind of annoying so I would want something that could do this:

    Code:
    Public Class MyApp 
            Private _strProperty As String 'Hit tab and it does this: 
    End Class
    "AutoCompletes" to:
    Code:
    Public Class MyApp 
            Private _strProperty As String 'Hit tab and it does this: 
            Public Property strProperty() As String 'replaces underscore as property name 
                Get 
                    Return _strProperty 'returns variable tabbed on 
                End Get 
                Set(ByVal value As String) 
                    _strProperty = value 'sets variable tabbed on 
                End Set 
            End Property 
    End Class

  9. #9
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Change Intellisense

    that is already built into VS... type the word "property" and hit tab

    Then tab to each "green" field you see, so you can name the variables what you want.

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Change Intellisense

    oh.. and not to metion VB10 will have auto properties like C# does now.

  11. #11
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: [RESOLVED] Change Intellisense

    When I think back to all the Properties...
    It's amazing how much you can know and not know at the same time. Thanks.

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Change Intellisense

    that is why the snippet editor Bill made is cool. If you do some common thing you are typing over and over again, you can build your own snippets to insert whatever you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width