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); }
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); }
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>(); }
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); } }
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); } } }
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); } }
public PresentationModeCommand(VsfPackage package, OleMenuCommandService omcs) : base(package, omcs) { this.state = package; Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidPresentationMode); }
public VsCommand(VsfPackage package, OleMenuCommandService omcs) { this.CommandService = omcs; this.Package = package; }
public AddOutliningCommand(VsfPackage package, OleMenuCommandService omcs) : base(package, omcs) { Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidAddOutlining); }
public ObfuscateTextCommand(VsfPackage package, OleMenuCommandService omcs) : base(package, omcs) { Initialize(new Guid(Guids.guidVsfViewCmdSet), PkgCmdIdList.cmdidObfuscateText); }
public SuoPersistUserSettings(VsfPackage package) { this.package = package; }
public RemoveOutliningCommand(VsfPackage package, OleMenuCommandService omcs) : base(package, omcs) { Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidRemoveOutlining); }
public CompleteWordCommand(VsfPackage package, OleMenuCommandService omcs) : base(package, omcs) { Initialize(new Guid(Guids.guidVsfTextEditorCmdSet), PkgCmdIdList.cmdidCompleteWord); }