Snippet problem

Topics: User Forum
Jan 29, 2012 at 7:59 PM

Hi all,

i have only been using ScintillaNET for a few days... but i have tryed to make my own .xml

im not trying to remake a "coding Language" i am trying to make a Editor for a game.. it helps you make new files for the game to see... i normally do this in just notepad but i got feed up with typing the same thing over and over again... so now the time is to make an editor with Intillisense to help me along the way...

i have used some code i found on here to add keywords to the application in code view (not from the xml) as i couldnt get it to use the xml properly 

i have now made a small xml so i can have code snippets in (i couldnt find how to do this in code so i read the cs.xml) now here comes my problem..

When i use the key to bring up the snippet it all works with no error... then after that snippet i wanted to use another snippet but the new snippet takes the old snippet as a child yet i dont want this... i will show what i mean..

Just one snippet in the textarea

Instance=garage
{
	MASFile=garagefloor.gmt
	Color=(0,0,0)
}

 

Now when i add a new one UNDER this one look what happens

 

Instance=Tyrerack
{
	Instance=garage
{
	MASFile=garagefloor.gmt
	Color=(0,0,0)
}


}

when i hit the button for new snippet it highlights all the code and ends like that. there is problem one lol

 

Problem 2

HOW can i add colour to custom keywords? the ONLY normal syntax i need is the // comment and True and False EVERYTHING else is game stuff not coding stuff

i have seen there is NO examples for this library :( and to add to that im using VB.NET to program this little application

 

Thanks for reading this LONG post and hope someone can help me

Kev

Jan 29, 2012 at 8:23 PM

i have just updated to the 93062  and now after i have typed one letter the box pops up for syntax but then if i type 2nd letter the syntax box emptys but stays onscreen


Jan 30, 2012 at 12:02 AM

i have sorted my snippets... i used. code..

 Medtior.Snippets.InsertSnippet(New ScintillaNet.Snippet("instance", "Instance=$name$ " + vbCrLf + _
"{" + vbCrLf + "	$end$$selected$" + vbCrLf + "}"))

i just need to find out how i set customer keyword coloring now... i have my keywords in a string....

 

 Private Const keywords As String = "SearchPath= MASFile= View= Clear= Color=( Size=( Center=(" + _
 "FOV=( ClipPlane=s( MaxShadowRange=( AmbientColor=( ReflectPlane=( Light= FDirect01 Type= Directional" + _
 "Dir=( Instance= Moveable= True False MeshFile= gmt CollTarget= HATTarget= ShadowCaster=( Static Solid" + _
 "Reflect= ReflectionMapper= TextureSize=( UpdateRate=( StaticSwitch=( TrackingIns= IncludeIns= CUBEASF Vehicles "

and then use then as so..

 

Private Sub Meditor_CharAdded(ByVal sender As Object, ByVal e As ScintillaNet.CharAddedEventArgs) Handles Meditor.CharAdded
        If e.Ch = " "c Then
            Return
        End If
        Dim pos As Integer = Meditor.NativeInterface.GetCurrentPos()
        Dim word As String = Meditor.GetWordFromPosition(pos)
        If word = String.Empty Then
            Return
        End If
        Dim list As List(Of String) = keywordList.FindAll(Function(item) item.StartsWith(word))

        If list.Count > 0 Then
            Meditor.AutoComplete.Show(list)
        End If
    End Sub

if someone could help me color these keywords Blue that would be gr8

 

Kev

Developer
Jan 30, 2012 at 1:05 AM

if your just filling from a keyword list, then the 4.0 branch should auto-show it for you, provided you've told it to do so.

Jan 30, 2012 at 9:35 AM

i had some strange errors with the build i posted above.. it only give me the list on the 1st letter and if i kept typing it went blank...

IE: i wanted to type MASFile so i started typing M and i got the list of all the M words... then i went MA and that should have just given me MASFile in the list but it didnt it was blank... so i have gone back to the MAIN download link on the home page and all is fine again

 

i have everything working how i want now apart from the keywords that i have added i need them to show BLUE. so my question is can i highlight my own keywords with code as im now not using any xml file

thank for the reply

Kev

Coordinator
Jan 30, 2012 at 5:52 PM

Keyword highlighting is a function of a language lexer. So even if you aren't using Scintilla to edit one of the built in language types you still need to assign a language so that the keywords get marked with a different style. I'm not sure which language would best work for your needs. Try a few different ones. Also you are best off only having letters in your keywords. Parens and equal signs have syntactic meaning in most languages which means the keyword may not ever get marked properly. That would make your list

s String = "SearchPath MASFile View Clear Color Size Center " + _
 "FOV ClipPlane MaxShadowRange AmbientColor ReflectPlane Light FDirect01 Type Directional " + _
 "Dir Instance Moveable True False MeshFile gmt CollTarget HATTarget ShadowCaster Static Solid " + _
 "Reflect ReflectionMapper TextureSize UpdateRate StaticSwitch TrackingIns IncludeIns CUBEASF Vehicles "
Jan 30, 2012 at 7:43 PM

thanks for the reply :)

i have now come to im not going to use highlighting as i need the words together... like masfile=somemesh.ext so the masfile wouldnt stay highlighted anyways......

one more question tho... can i have keyswords ONLY display if i hit the . (dot key) so i can have different keywords for different things? like one set for . another for = and then the rest for just typing... i have it on just typing atm but dont know how to do the if i hit the . key or something

its just that way most of the time the user will hit the = key it will just be True or False

thanks again for the reply and this library is perfect for what im doing now :D

PS: i will prob ask more questions as i make it more advanced

Kev