Frage

Ich versuche, Syntax zu machen hervorheben und den Aufbau Optionen Arbeit für Geany, einen Rat?

War es hilfreich?

Lösung

Schauen Sie in $ GOROOT / misc und http://go-lang.cat -v.org/text-editors/ für Syntax-Dateien aus anderen Editoren eine Vorstellung zu bekommen.

das Barring, beginnen Sie mit C oder C ++ und Add / subtrahieren Dinge wie go, <-, func, etc.

Andere Tipps

Ich habe gerade bemerkt, diese Seite: http://go-lang.cat-v.org/ Text-Editoren / geany /

Es scheint, als ob sie alles haben müssen Sie recht.

Hier ist die Geany Anleitung von Steve Horsley zu golang-Nüsse geschrieben Formatierung:

  1. In Geany, zur Tools-> Konfiguration Dateien-> filetype_extensions.conf und in der folgenden neuen Überschrift hinzufügen:

    Go=*.go;
    
  2. Kopieren Sie die C-Definition filetypes.c zu filedefs / filetypes.Go.conf:

    cp /usr/share/geany/filetypes.c ~/.config/geany/filedefs/filetypes.Go.conf
    
  3. Bearbeiten filetypes.Go.conf und ändern Sie die Einstellung und Schlüsselwörter Abschnitte dazu:

    [settings]
    # default extension used when saving files
    extension=go
    lexer_filetype=C
    
    [keywords]
    # all items must be in one line
    primary=break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var
    secondary=byte int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float32 float64 complex64 complex128 uintptr string
    

Haben Sie die Go-Datei des Typs definiert in ~ / .config / geany / filetype_extensions.conf?

[Extensions]
...
Go=*.go
...

, wenn die conf-Datei noch nicht existiert, kopieren Sie es von / usr / share / geany und fügen Sie diese Zeile unter ‚Erweiterungen‘ (oder suchen sie unter Extras> Konfigurationsdateien).

Ich habe einen Python-Skript, dass die automates Richtungen in der Verbindung von Jaybill McCarthy zur Verfügung gestellt.

import shutil, re, os

HOME = os.environ['HOME']

shutil.copy('/usr/share/geany/filetype_extensions.conf', HOME +'/.config/geany/')
with open(HOME + '/.config/geany/filetype_extensions.conf', 'r') as f:
    fileData = f.read()
fileData = re.sub(r'Haskell=.*;', r'Go=*.go;\nHaskell=*.hs;*.lhs;', fileData)
fileData = re.compile('(\[Groups\][^\[]Programming=.*?$)', re.DOTALL|re.MULTILINE).sub(r'\1Go;', fileData)
with open(HOME + '/.config/geany/filetype_extensions.conf', 'w') as f:
    f.write(fileData)


textSettings = """[settings]
extension=go
lexer_filetype=C
comment_single=//
comment_open=/*
comment_close=*/
comment_use_indent=true
"""
textKeywords = """[keywords]
primary=break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var
secondary=byte int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float32 float64 complex64 complex128 uintptr string"""

shutil.copy('/usr/share/geany/filetypes.c', HOME + '/.config/geany/filedefs/filetypes.Go.conf')
with open(HOME + '/.config/geany/filedefs/filetypes.Go.conf', 'r') as f:
    fileData = f.read()
fileData = re.compile(r'\[settings\].*?^\[', re.DOTALL|re.MULTILINE).sub('%s\n\n[' %textSettings, fileData)
fileData = re.compile(r'\[keywords\].*?^\[', re.DOTALL|re.MULTILINE).sub('%s\n\n[' %textKeywords, fileData)
with open(HOME + '/.config/geany/filedefs/filetypes.Go.conf', 'w') as f:
    f.write(fileData)

print "Complete!"

Ich bin mir nicht sicher, ob dies bedeutet, ich bin faul, oder umgekehrt ... ò.ó.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top