Esempio n. 1
0
        public void ParseModeline(int numLine)
        {
            ITextBuffer buffer   = this.theView.TextBuffer;
            var         snapshot = buffer.CurrentSnapshot;

            if (snapshot.LineCount <= numLine)
            {
                return;
            }
            ILanguage language = langFactory.TryCreateLanguage(snapshot);

            if (language == null)
            {
                return;
            }

            var firstLine = snapshot.GetLineFromLineNumber(numLine);

            ITextChars tc          = new LineChars(firstLine);
            String     commentText = language.NewFirstLineCommentParser().Parse(tc);

            if (String.IsNullOrEmpty(commentText))
            {
                return;
            }
            VsfPackage.LogInfo("Found possible modeline: {0}", commentText);

            var modelineParser = new ModeLineParser();
            var options        = modelineParser.Parse(commentText);

            ApplyModelines(options);
        }
Esempio n. 2
0
        public PresentationModeCommand(VsfPackage package, OleMenuCommandService omcs)
            : base(package, omcs)
        {
            var model = new SComponentModel();

            this.state = model.GetService <IPresentationModeState>();
            Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidPresentationMode);
        }
Esempio n. 3
0
 private void SetZoomLevel(IWpfTextView textView)
 {
     if (VsfSettings.PresentationModeEnabled)
     {
         int zoomLevel = VsfPackage.GetPresentationModeZoomLevel();
         textView.ZoomLevel = zoomLevel;
     }
 }
        public ObfuscateTextCommand(VsfPackage package, OleMenuCommandService omcs)
            : base(package, omcs)
        {
            Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidObfuscateText);
            SComponentModel model = new SComponentModel();

            this.telemetry = model.GetService <IVsfTelemetry>();
        }
Esempio n. 5
0
 protected override void OnInvoke(object sender, EventArgs e)
 {
     base.OnInvoke(sender, e);
     VsfPackage.PresentationModeTurnedOn = !VsfPackage.PresentationModeTurnedOn;
     if (VsfPackage.PresentationModeChanged != null)
     {
         VsfPackage.PresentationModeChanged(this, EventArgs.Empty);
     }
 }
Esempio n. 6
0
 public void Load()
 {
     if (File.Exists(filePath))
     {
         try {
             XDocument doc = XDocument.Load(filePath);
             foreach (var element in doc.Root.Elements())
             {
                 settings[element.Name.LocalName] = element.Value;
             }
         } catch (XmlException ex) {
             VsfPackage.LogInfo("Error loading '{0}': {1}", filePath, ex);
         }
     }
 }
Esempio n. 7
0
        private void ApplyModeLine(String key, String value)
        {
            VsfPackage.LogInfo("Modeline: {0}={1}", key, value);
            if (String.IsNullOrEmpty(value))
            {
                // assume this is a boolean option
                value = key.StartsWith("no") ? "false" : "true";
            }
            Action <IWpfTextView, String> option;

            if (optionMap.TryGetValue(key, out option))
            {
                option(theView, value);
            }
        }
Esempio n. 8
0
 public PresentationModeCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     this.state = package;
     Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidPresentationMode);
 }
Esempio n. 9
0
 public VsCommand(VsfPackage package, OleMenuCommandService omcs)
 {
     this.CommandService = omcs;
       this.Package = package;
 }
Esempio n. 10
0
 public AddOutliningCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidAddOutlining);
 }
 public PresentationModeCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     this.state = package;
       Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidPresentationMode);
 }
Esempio n. 12
0
 public ObfuscateTextCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidObfuscateText);
 }
Esempio n. 13
0
 public SuoPersistUserSettings(VsfPackage package)
 {
     this.package = package;
 }
Esempio n. 14
0
 public RemoveOutliningCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidRemoveOutlining);
 }
Esempio n. 15
0
 public VsCommand(VsfPackage package, OleMenuCommandService omcs)
 {
     this.CommandService = omcs;
     this.Package        = package;
 }
Esempio n. 16
0
 public CompleteWordCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidCompleteWord);
 }
Esempio n. 17
0
 public SuoPersistUserSettings(VsfPackage package)
 {
     this.package = package;
 }
Esempio n. 18
0
 public ObfuscateTextCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidObfuscateText);
 }
Esempio n. 19
0
 public CompleteWordCommand(VsfPackage package, OleMenuCommandService omcs)
     : base(package, omcs)
 {
     Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidCompleteWord);
 }