//TODO:flattened project
public IEnumerable<Project> FlattenProjects {
get {
- foreach (var node in Projects.SelectMany (child => child.FlattenSubProjetcs))
+ foreach (var node in Projects.SelectMany (child => child.FlattenProjetcs))
yield return node;
}
}
protected Project parent;
public abstract bool ContainsFile (string fullPath);
public IEnumerable<Project> SubProjetcs => Childs.OfType<Project> ();
- public IEnumerable<Project> FlattenSubProjetcs {
+ public virtual IEnumerable<Project> FlattenProjetcs {
get {
- foreach (var node in SubProjetcs.SelectMany (sp => sp.FlattenSubProjetcs))
+ yield return this;
+ foreach (var node in SubProjetcs.SelectMany (sp => sp.FlattenProjetcs))
yield return node;
}
}
if (currentLoc == value)
return;
currentLoc = value;
- if (currentLoc.HasValue)
- getFoldContainingLine (currentLoc.Value.Line)?.UnfoldToTheTop();
+ if (currentLoc.HasValue) {
+ SyntaxNode fold = getFoldContainingLine (currentLoc.Value.Line);
+ while (fold != null && fold.StartLine == currentLoc.Value.Line)
+ fold = fold.Parent;
+ fold?.UnfoldToTheTop();
+ }
NotifyValueChanged ("CurrentLine", CurrentLine);
NotifyValueChanged ("CurrentColumn", CurrentColumn);
CMDCopy.CanExecute = CMDCut.CanExecute = !SelectionIsEmpty;
public abstract NodeType NodeType { get; }
public abstract string Icon { get; }
public virtual string IconSub => null;
+ public virtual string StatusIcon => null;
public T GetFirstAncestorOfType<T> () where T : TreeNode {
TreeNode n = this;
while (n.Parent != null && !(n is T))
MouseWheelSpeed = "20";
BubbleEvents ="None";
ClipToClientRect = "true";
+ MouseCursor = "ibeam";
}
icon {
<Image Style="TreeIcon"
Path="{Icon}" SvgSub="{IconSub}"/>
<Label Style="TreeLabel" Text="{./Caption}"/>
+ <Image Style="TreeIconSmall" Path="{StatusIcon}" />
</HorizontalStack>
</Border>
</ListItem>
}
-
-
+ #region Commands
public Command CMDStartRecording, CMDStopRecording, CMDRefresh;
public Command CMDGotoParentEvent, CMDEventHistoryForward, CMDEventHistoryBackward;
public CommandGroup LoggerCommands => new CommandGroup (CMDRefresh, CMDStartRecording, CMDStopRecording);
public CommandGroup EventCommands => new CommandGroup(
CMDGotoParentEvent, CMDEventHistoryBackward, CMDEventHistoryForward);
+ public ActionCommand CMDOptions_SelectCrowAssemblyLocation => new ActionCommand ("...",
+ () => {
+ FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
+ <FileDialog Caption='Select Crow.dll assembly' CurrentDirectory='{CrowDbgAssemblyLocation}'
+ ShowFiles='true' ShowHidden='true' />");
+ dlg.OkClicked += (sender, e) => CrowDbgAssemblyLocation = (sender as FileDialog).SelectedFileFullPath;
+ dlg.DataSource = this;
+ }
+ );
+ public ActionCommand CMDOptions_AddCrowAssembly => new ActionCommand ("Add Assembly with Crow Ressource",
+ () => {
+ FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
+ <FileDialog Caption='Select Assembly with Crow Ressources' CurrentDirectory='{CrowDbgAssemblyLocation}'
+ ShowFiles='true' ShowHidden='true' />");
+ dlg.OkClicked += (sender, e) => {
+ crowAssemblies.Add ((sender as FileDialog).SelectedFileFullPath);
+ saveCrowAssemblies ();
+ };
+ dlg.DataSource = this;
+ }
+ );
+
void initCommands ()
{
App.ViewCommands.Add (
CMDEventHistoryBackward = new ActionCommand("back.", currentEventHistoryGoBack, "#icons.previous.svg", false);
CMDEventHistoryForward = new ActionCommand("forw.", currentEventHistoryGoForward, "#icons.forward-arrow.svg", false);
}
+ #endregion
+
public void LoadIML (string imlSource) {
if (CurrentState == Status.Running)
delSetSource (imlSource);
}
Exception currentException;
+ public string ErrorMessage = "";
+ public bool ServiceIsInError;
object dbgIFace;
AssemblyLoadContext crowLoadCtx;
Assembly crowAssembly, thisAssembly;
Func<IntPtr> delGetSurfacePointer;
Action<string> delSetSource;
Action delReloadIml;
+ Func<double> delGetZoomFactor;
+ Action<double> delSetZoomFactor;
+
FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput, fiDbgIFace_MaxLayoutingTries, fiDbgIFace_MaxDiscardCount;
#endregion
public bool PreviewHasError => currentException != null;
public Exception CurrentException {
get => currentException;
- set {
+ private set {
if (currentException == value)
return;
currentException = value;
NotifyValueChanged (value);
}
}
- public string ErrorMessage = "";
- public bool ServiceIsInError;
void updateCrowDebuggerState (string errorMsg = null) {
ErrorMessage = errorMsg;
ServiceIsInError = errorMsg != null;
NotifyValueChanged ("ServiceErrorMessage", (object)ErrorMessage);
NotifyValueChanged ("ServiceIsInError", ServiceIsInError);
}
- public void GetMouseScreenCoordinates (out int x, out int y) {
+
+ #region DesignInterface callbacks
+ //those methods are called by designed interface
+ void getMouseScreenCoordinates (out int x, out int y) {
x = mouseScreenPos.X;
y = mouseScreenPos.Y;
}
- void saveCrowAssemblies () {
- if (crowAssemblies.Count > 0)
- Configuration.Global.Set ("CrowAssemblies", crowAssemblies.Aggregate ((a, b)=> $"{a};{b}"));
- else
- Configuration.Global.Set ("CrowAssemblies", "");
+ IEnumerable<object> getStyling () {
+ if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
+ if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
+ foreach (var style in csprj.Flatten.OfType<CERoslynPlugin.ProjectItemNode>()
+ .Where (pin=>pin.NodeType == NodeType.EmbeddedResource && pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase)))
+ yield return style.FullPath;
+ }
+ }
+ yield return crowAssembly;
}
- void loadCrowAssemblies () {
- crowAssemblies.Clear ();
- if (!Configuration.Global.TryGet<string> ("CrowAssemblies", out string assemblies))
- return;
- foreach (string a in assemblies.Split (';'))
- crowAssemblies.Add (a);
+ Stream getStreamFromPath (string path) {
+ if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
+ if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
+ return csprj.GetStreamFromTargetPath (path);
+ }
+ }
+ return null;
}
-
+ #endregion
public override void Start()
{
if (CurrentState == Status.Running)
dbgIFace, dbgIfaceType.GetProperty("Source").GetSetMethod());
delReloadIml = (Action)Delegate.CreateDelegate(typeof(Action), dbgIFace, dbgIfaceType.GetMethod("ReloadIml"));
+ delGetZoomFactor = (Func<double>)Delegate.CreateDelegate(typeof(Func<double>),
+ dbgIFace, dbgIfaceType.GetProperty("ZoomFactor").GetGetMethod());
+ delSetZoomFactor = (Action<double>)Delegate.CreateDelegate(typeof(Action<double>),
+ dbgIFace, dbgIfaceType.GetProperty("ZoomFactor").GetSetMethod());
+
fiDbgIFace_IsDirty = dbgIfaceType.GetField("IsDirty");
fiDbgIFace_MaxLayoutingTries = dbgIfaceType.GetField("MaxLayoutingTries", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
fiDbgIFace_MaxDiscardCount = dbgIfaceType.GetField("MaxDiscardCount", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
CurrentState = Status.Running;
updateCrowDebuggerState();
+
+ delSetZoomFactor (ZoomFactor);
}
public override void Stop()
{
CurrentState = Status.Paused;
}
public override string ConfigurationWindowPath => "#CECrowPlugin.ui.winConfiguration.crow";
-
+ Project activeSolution;
+ public Project ActiveSolution {
+ get => activeSolution;
+ set {
+ CERoslynPlugin.SolutionProject sol = value as CERoslynPlugin.SolutionProject;
+ if (activeSolution == sol)
+ return;
+ activeSolution = sol;
+ NotifyValueChanged (activeSolution);
+ }
+ }
public string CrowDbgAssemblyLocation {
get => Configuration.Global.Get<string> ("CrowDbgAssemblyLocation");
set {
NotifyValueChanged(value);
}
}
+ public double ZoomFactor {
+ get => Configuration.Global.Get<Double> ("CrowPreviewZoomFactor", 1.0);
+ set {
+ if (ZoomFactor == value)
+ return;
+ Configuration.Global.Set<Double> ("CrowPreviewZoomFactor", value);
+ NotifyValueChanged (value);
+ if (CurrentState == Status.Running)
+ delSetZoomFactor (value);
+ }
+ }
//assemblies with crow resources in order of loading
IList<string> crowAssemblies = new ObservableList<string> ();
public IList<string> CrowAssemblies => crowAssemblies;
+ void saveCrowAssemblies () {
+ if (crowAssemblies.Count > 0)
+ Configuration.Global.Set ("CrowAssemblies", crowAssemblies.Aggregate ((a, b)=> $"{a};{b}"));
+ else
+ Configuration.Global.Set ("CrowAssemblies", "");
+ }
+ void loadCrowAssemblies () {
+ crowAssemblies.Clear ();
+ if (!Configuration.Global.TryGet<string> ("CrowAssemblies", out string assemblies))
+ return;
+ foreach (string a in assemblies.Split (';'))
+ crowAssemblies.Add (a);
+ }
+
- public ActionCommand CMDOptions_SelectCrowAssemblyLocation => new ActionCommand ("...",
- () => {
- FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
- <FileDialog Caption='Select Crow.dll assembly' CurrentDirectory='{CrowDbgAssemblyLocation}'
- ShowFiles='true' ShowHidden='true' />");
- dlg.OkClicked += (sender, e) => CrowDbgAssemblyLocation = (sender as FileDialog).SelectedFileFullPath;
- dlg.DataSource = this;
- }
- );
- public ActionCommand CMDOptions_AddCrowAssembly => new ActionCommand ("Add Assembly with Crow Ressource",
- () => {
- FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
- <FileDialog Caption='Select Assembly with Crow Ressources' CurrentDirectory='{CrowDbgAssemblyLocation}'
- ShowFiles='true' ShowHidden='true' />");
- dlg.OkClicked += (sender, e) => {
- crowAssemblies.Add ((sender as FileDialog).SelectedFileFullPath);
- saveCrowAssemblies ();
- };
- dlg.DataSource = this;
- }
- );
-
protected override void onStateChange(Status previousState, Status newState)
{
try
{
mouseScreenPos = _mouseScreenPos;//absolute on screen position.
- e.Handled = delMouseMove (e.X, e.Y);//DebugInterface local coordinate for mouse.
+ e.Handled = delMouseMove ((int)(e.X / ZoomFactor), (int)(e.Y / ZoomFactor));//DebugInterface local coordinate for mouse.
}
catch (System.Exception ex)
{
fiDbgIFace_IsDirty.SetValue (dbgIFace, false);
}
public bool GetDirtyState => IsRunning ? (bool)fiDbgIFace_IsDirty.GetValue (dbgIFace) : false;
- public IEnumerable<object> GetStyling () {
- if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
- if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
- foreach (var style in csprj.Flatten.OfType<CERoslynPlugin.ProjectItemNode>()
- .Where (pin=>pin.NodeType == NodeType.EmbeddedResource && pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase)))
- yield return style.FullPath;
- }
- }
- yield return crowAssembly;
- }
- public Stream GetStreamFromPath (string path) {
- if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
- if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
- return csprj.GetStreamFromTargetPath (path);
- }
- }
- return null;
- }
#region Debug log
IList<DbgEvent> events;
public bool Terminate;
string source;
Action delRegisterForRepaint;//call RegisterForRepaint in the container widget (DebugInterfaceWidget)
- Action<Exception> delSetCurrentException;
+ Action<Exception> delCrowServiceSetCurrentException;
delegate void GetScreenCoordinateDelegateType(out int x, out int y);
- GetScreenCoordinateDelegateType delGetScreenCoordinate;
- Func<IEnumerable<object>> delGetStyling;
- Func<string, Stream> delGetStreamFromPath;
+ GetScreenCoordinateDelegateType delCrowServiceGetScreenCoordinate;
+ Func<IEnumerable<object>> delCrowServiceGetStyling;
+ Func<string, Stream> delCrowServiceGetStreamFromPath;
void interfaceThread () {
while (!Terminate) {
Monitor.Exit (UpdateMutex);
while (Monitor.IsEntered(ClippingMutex))
Monitor.Exit (ClippingMutex);*/
- delSetCurrentException (ex);
+ delCrowServiceSetCurrentException (ex);
Console.WriteLine ($"[DbgIFace] {ex}");
ClearInterface();
Thread.Sleep(1000);
Thread.Sleep (UPDATE_INTERVAL);
}
}
- public IntPtr SurfacePointer {
+ public new IntPtr SurfacePointer {
get {
lock(UpdateMutex)
return surf.Handle;
}
}
- public void RegisterDebugInterfaceCallback (object w){
- Type t = w.GetType();
+ public void RegisterDebugInterfaceCallback (object crowService){
+ Type t = crowService.GetType();
//delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint"));
- delSetCurrentException = (Action<Exception>)Delegate.CreateDelegate(typeof(Action<Exception>), w, t.GetProperty("CurrentException").GetSetMethod());
- delGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), w, t.GetMethod("GetMouseScreenCoordinates"));
- delGetStyling = (Func<IEnumerable<object>>)Delegate.CreateDelegate (typeof (Func<IEnumerable<object>>), w, t.GetMethod ("GetStyling"));
- delGetStreamFromPath = (Func<string, Stream>)Delegate.CreateDelegate (typeof (Func<string, Stream>), w, t.GetMethod ("GetStreamFromPath"));
+ delCrowServiceSetCurrentException = (Action<Exception>)Delegate.CreateDelegate(typeof(Action<Exception>), crowService,
+ t.GetProperty("CurrentException").GetSetMethod(true));
+ delCrowServiceGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), crowService,
+ t.GetMethod("getMouseScreenCoordinates", BindingFlags.Instance | BindingFlags.NonPublic));
+ delCrowServiceGetStyling = (Func<IEnumerable<object>>)Delegate.CreateDelegate (typeof (Func<IEnumerable<object>>), crowService,
+ t.GetMethod ("getStyling", BindingFlags.Instance | BindingFlags.NonPublic));
+ delCrowServiceGetStreamFromPath = (Func<string, Stream>)Delegate.CreateDelegate (typeof (Func<string, Stream>), crowService,
+ t.GetMethod ("getStreamFromPath", BindingFlags.Instance | BindingFlags.NonPublic));
}
/*public void ResetDirtyState () {
IsDirty = false;
if (source == value)
return;
source = value;
- delSetCurrentException(null);
+ delCrowServiceSetCurrentException(null);
try
{
lock (UpdateMutex) {
}
catch (IML.InstantiatorException iTorEx)
{
- delSetCurrentException(iTorEx.InnerException);
+ delCrowServiceSetCurrentException(iTorEx.InnerException);
}
catch (System.Exception ex)
{
- delSetCurrentException(ex);
+ delCrowServiceSetCurrentException(ex);
}
}
}
void resetInterface () {
ClearInterface();
initDictionaries();
- foreach (object style in delGetStyling ()) {
+ foreach (object style in delCrowServiceGetStyling ()) {
if (style is string stylePath)
LoadStyle (stylePath);
else if (style is Assembly styleAssembly)
}
public override void ForceMousePosition()
{
- delGetScreenCoordinate(out int x, out int y);
+ delCrowServiceGetScreenCoordinate(out int x, out int y);
Glfw.Glfw3.SetCursorPosition (WindowHandle, x, y);
}
public override Stream GetStreamFromPath(string path)
{
- Stream result = delGetStreamFromPath (path);
+ Stream result = delCrowServiceGetStreamFromPath (path);
if (result != null)
return result;
return base.GetStreamFromPath (path);
NotifyValueChangedAuto (crowIFaceService);
}
}
- Command CMDRefresh;
+ Command CMDRefresh, CMDZoomIn, CMDZoomOut;
public DebugInterfaceWidget () : base () {
CMDRefresh = new ActionCommand (this, "Refresh",
() => {
},
"#icons.refresh.svg",
new KeyBinding (Key.F3));
+ CMDZoomIn = new ActionCommand ("Zoom in",
+ () => {
+ if (crowIFaceService != null) {
+ crowIFaceService.ZoomFactor *= 2.0;
+ RegisterForGraphicUpdate ();
+ }
+ }, "#icons.zoom-in.svg");
+ CMDZoomOut = new ActionCommand ("Zoom out",
+ () => {
+ if (crowIFaceService != null) {
+ crowIFaceService.ZoomFactor /= 2.0;
+ RegisterForGraphicUpdate ();
+ }
+ }, "#icons.zoom-out.svg");
Thread t = new Thread (backgroundThreadFunc);
t.IsBackground = true;
new Command("Load from file", () => loadLogFromDebugLogFilePath ())
);*/
public CommandGroup WindowCommands => new CommandGroup (
- CMDRefresh,
+ CMDRefresh, CMDZoomIn, CMDZoomOut,
crowIFaceService.CMDStartRecording,
crowIFaceService.CMDStopRecording,
crowIFaceService.CMDOpenConfig,
(Parent.LogicalParent as DockWindow).CMDClose
);
-
protected override void onDraw(Context gr)
{
Console.WriteLine("onDraw");
if (msbp.IsCrowProject)
}*/
}
+ protected override Tokenizer CreateTokenizer() => new ImlTokenizer ();
string[] allWidgetNames = typeof (Widget).Assembly.GetExportedTypes ().Where(t=>typeof(Widget).IsAssignableFrom (t))
.Select (s => s.Name).ToArray ();
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Crow.Text;
+using System.Collections.Generic;
+using CrowEditBase;
+using CrowEdit.Xml;
+
+namespace CECrowPlugin
+{
+ public class ImlTokenizer : XmlTokenizer {
+ protected override void parseAttributeValue (ref SpanCharReader reader) {
+ char q = reader.Read();
+ addTok (ref reader, XmlTokenType.AttributeValueOpen);
+ while (!reader.EndOfSpan) {
+ if (reader.Eol()) {
+ addTok (ref reader, XmlTokenType.AttributeValue);
+ reader.ReadEol();
+ addTok (ref reader, XmlTokenType.LineBreak);
+ continue;
+ }
+ if (reader.TryPeak (q)) {
+ addTok (ref reader, XmlTokenType.AttributeValue);
+ reader.Advance (1);
+ addTok (ref reader, XmlTokenType.AttributeValueClose);
+ return;
+ } else
+ reader.Read ();
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace CECrowPlugin
+{
+ [Flags]
+ public enum StyleTokenType {
+ Unknown,
+ Trivia = 0x0100,
+ WhiteSpace = 0x4100,
+ Tabulation = 0x4101,
+ LineBreak = 0x4102,
+ LineCommentStart = 0x0102,
+ LineComment = 0x0103,
+ BlockCommentStart = 0x0104,
+ BlockComment = 0x0105,
+ BlockCommentEnd = 0x0106,
+ Name = 0x0200,
+ StyleKey = 0x0201,//may be a class name or a style name.
+ MemberName = 0x0202,
+ ConstantName = 0x0203,
+ Punctuation = 0x0400,
+ OpeningBrace = 0x0401,// '{'
+ ClosingBrace = 0x0402,// '}'
+ Comma = 0x0403,// ','
+ EndOfExpression = 0x0404,// ';'
+ EqualSign = 0x0801,
+ MemberValuePart = 0x2000,
+ MemberValueOpen = 0x2401,
+ MemberValueClose = 0x2402,
+ ConstantRefOpen = 0x2403,// '${'
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Crow.Text;
+using System.Collections.Generic;
+using CrowEditBase;
+using System.Globalization;
+using Crow.Coding;
+
+namespace CECrowPlugin {
+ public class StyleTokenizer : Tokenizer {
+ enum States {
+ classNames, members, value, endOfStatement
+ }
+
+ States curState;
+
+ public StyleTokenizer () {}
+
+ bool readName (ref SpanCharReader reader) {
+ if (reader.EndOfSpan)
+ return false;
+ char c = reader.Peak;
+ if (char.IsLetter(c) || c == '_' ) {
+ reader.Advance ();
+ while (reader.TryPeak (ref c)) {
+ if (!char.IsLetterOrDigit(c)) {
+ UnicodeCategory uc = Char.GetUnicodeCategory (c);
+ if (uc != UnicodeCategory.NonSpacingMark &&
+ uc != UnicodeCategory.SpacingCombiningMark &&
+ uc != UnicodeCategory.ConnectorPunctuation &&
+ uc != UnicodeCategory.Format)
+ return true;
+ }
+ reader.Advance ();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public override Token[] Tokenize (string source) {
+ SpanCharReader reader = initParsing (source);
+
+ curState = States.classNames;
+
+ while(!reader.EndOfSpan) {
+
+ skipWhiteSpaces (ref reader);
+
+ if (reader.EndOfSpan)
+ break;
+
+ switch (reader.Peak) {
+ case '/':
+ reader.Advance ();
+ if (reader.TryPeak ('/')) {
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.LineCommentStart);
+ reader.AdvanceUntilEol ();
+ addTok (ref reader, StyleTokenType.LineComment);
+ } else if (reader.TryPeak ('*')) {
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.BlockCommentStart);
+ if (reader.TryReadUntil ("*/")) {
+ addTok (ref reader, StyleTokenType.BlockComment);
+ reader.Advance (2);
+ addTok (ref reader, StyleTokenType.BlockCommentEnd);
+ }
+ }
+ break;
+ case ',':
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.Comma);
+ curState = States.classNames;
+ break;
+ case '{':
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.OpeningBrace);
+ curState = States.members;
+ break;
+ case '}':
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.ClosingBrace);
+ curState = States.classNames;
+ break;
+ case '=':
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.EqualSign);
+ curState = States.value;
+ break;
+ case '"':
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.MemberValueOpen);
+
+ while (!reader.EndOfSpan) {
+ if (reader.TryPeak ("${")) {
+ addTok (ref reader, StyleTokenType.MemberValuePart);
+ reader.Advance (2);
+ addTok (ref reader, StyleTokenType.ConstantRefOpen);
+
+ while (!reader.EndOfSpan) {
+ if (reader.TryPeak ('}')) {
+ addTok (ref reader, StyleTokenType.ConstantName);
+ reader.Read ();
+ addTok (ref reader, StyleTokenType.ClosingBrace);
+ break;
+ }
+ reader.Advance ();
+ }
+ continue;
+ } else if (reader.TryPeak ('\"')) {
+ addTok (ref reader, StyleTokenType.MemberValuePart);
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.MemberValueClose);
+ break;
+ }
+ reader.Advance ();
+ }
+ curState = States.endOfStatement;
+ break;
+ case ';':
+ reader.Advance();
+ addTok (ref reader, StyleTokenType.EndOfExpression);
+ curState = States.members;
+ break;
+ default:
+ if (readName (ref reader)) {
+ addTok (ref reader, StyleTokenType.Name);
+ break;
+ }
+ reader.Advance ();
+ addTok (ref reader, StyleTokenType.Unknown);
+ break;
+ }
+
+ }
+
+ return Toks.ToArray();
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2021-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using CrowEditBase;
+
+namespace CECrowPlugin
+{
+ public class StyleSyntaxAnalyser : SyntaxAnalyser {
+ public override SyntaxNode Root => CurrentNode;
+ public StyleSyntaxAnalyser (StyleDocument source) : base (source) {
+ this.source = source;
+ }
+
+ SyntaxNode CurrentNode;
+ Token previousTok;
+ IEnumerator<Token> iter;
+ int currentLine;
+ public override void Process () {
+ StyleDocument doc = source as StyleDocument;
+ Exceptions = new List<SyntaxException> ();
+ CurrentNode = new StyleRootSyntax (doc);
+ previousTok = default;
+ iter = doc.Tokens.AsEnumerable().GetEnumerator ();
+ currentLine = 0;
+
+ bool notEndOfSource = iter.MoveNext ();
+ while (notEndOfSource) {
+ if (iter.Current.Type == TokenType.LineBreak)
+ currentLine++;
+ else if (!iter.Current.Type.HasFlag (TokenType.Trivia)) {
+ }
+
+ previousTok = iter.Current;
+ notEndOfSource = iter.MoveNext ();
+ }
+ while (currentNode.Parent != null) {
+ if (!currentNode.LastTokenOffset.HasValue)
+ storeCurrentNode (-1);
+ else
+ currentNode = currentNode.Parent;
+ }
+ setCurrentNodeEndLine (currentLine);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using CrowEditBase;
+
+namespace CECrowPlugin
+{
+
+ public class StyleRootSyntax : SyntaxRootNode {
+ public StyleRootSyntax (StyleDocument source)
+ : base (source) {
+ }
+ }
+
+ public class AttributeSyntax : SyntaxNode {
+ public Token? NameToken { get; internal set; }
+ public Token? EqualToken { get; internal set; }
+ public Token? ValueOpenToken { get; internal set; }
+ public Token? ValueCloseToken { get; internal set; }
+ public Token? ValueToken { get; internal set; }
+ public AttributeSyntax (int startLine, int startTok) : base (startLine, startTok) {}
+ public override bool IsComplete => base.IsComplete & NameToken.HasValue & EqualToken.HasValue &
+ ValueToken.HasValue & ValueOpenToken.HasValue & ValueCloseToken.HasValue;
+ }
+}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace CECrowPlugin
-{
- [Flags]
- public enum StyleTokenType {
- Unknown,
- Trivia = 0x0100,
- WhiteSpace = 0x4100,
- Tabulation = 0x4101,
- LineBreak = 0x4102,
- LineCommentStart = 0x0102,
- LineComment = 0x0103,
- BlockCommentStart = 0x0104,
- BlockComment = 0x0105,
- BlockCommentEnd = 0x0106,
- Name = 0x0200,
- StyleKey = 0x0201,//may be a class name or a style name.
- MemberName = 0x0202,
- ConstantName = 0x0203,
- Punctuation = 0x0400,
- OpeningBrace = 0x0401,// '{'
- ClosingBrace = 0x0402,// '}'
- Comma = 0x0403,// ','
- EndOfExpression = 0x0404,// ';'
- EqualSign = 0x0801,
- MemberValuePart = 0x2000,
- MemberValueOpen = 0x2401,
- MemberValueClose = 0x2402,
- ConstantRefOpen = 0x2403,// '${'
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using Crow.Text;
-using System.Collections.Generic;
-using CrowEditBase;
-using System.Globalization;
-using Crow.Coding;
-
-namespace CECrowPlugin {
- public class StyleTokenizer : Tokenizer {
- enum States {
- classNames, members, value, endOfStatement
- }
-
- States curState;
-
- public StyleTokenizer () {}
-
- bool readName (ref SpanCharReader reader) {
- if (reader.EndOfSpan)
- return false;
- char c = reader.Peak;
- if (char.IsLetter(c) || c == '_' ) {
- reader.Advance ();
- while (reader.TryPeak (ref c)) {
- if (!char.IsLetterOrDigit(c)) {
- UnicodeCategory uc = Char.GetUnicodeCategory (c);
- if (uc != UnicodeCategory.NonSpacingMark &&
- uc != UnicodeCategory.SpacingCombiningMark &&
- uc != UnicodeCategory.ConnectorPunctuation &&
- uc != UnicodeCategory.Format)
- return true;
- }
- reader.Advance ();
- }
- return true;
- }
- return false;
- }
-
- public override Token[] Tokenize (string source) {
- SpanCharReader reader = initParsing (source);
-
- curState = States.classNames;
-
- while(!reader.EndOfSpan) {
-
- skipWhiteSpaces (ref reader);
-
- if (reader.EndOfSpan)
- break;
-
- switch (reader.Peak) {
- case '/':
- reader.Advance ();
- if (reader.TryPeak ('/')) {
- reader.Advance ();
- addTok (ref reader, StyleTokenType.LineCommentStart);
- reader.AdvanceUntilEol ();
- addTok (ref reader, StyleTokenType.LineComment);
- } else if (reader.TryPeak ('*')) {
- reader.Advance ();
- addTok (ref reader, StyleTokenType.BlockCommentStart);
- if (reader.TryReadUntil ("*/")) {
- addTok (ref reader, StyleTokenType.BlockComment);
- reader.Advance (2);
- addTok (ref reader, StyleTokenType.BlockCommentEnd);
- }
- }
- break;
- case ',':
- reader.Advance ();
- addTok (ref reader, StyleTokenType.Comma);
- curState = States.classNames;
- break;
- case '{':
- reader.Advance ();
- addTok (ref reader, StyleTokenType.OpeningBrace);
- curState = States.members;
- break;
- case '}':
- reader.Advance ();
- addTok (ref reader, StyleTokenType.ClosingBrace);
- curState = States.classNames;
- break;
- case '=':
- reader.Advance ();
- addTok (ref reader, StyleTokenType.EqualSign);
- curState = States.value;
- break;
- case '"':
- reader.Advance ();
- addTok (ref reader, StyleTokenType.MemberValueOpen);
-
- while (!reader.EndOfSpan) {
- if (reader.TryPeak ("${")) {
- addTok (ref reader, StyleTokenType.MemberValuePart);
- reader.Advance (2);
- addTok (ref reader, StyleTokenType.ConstantRefOpen);
-
- while (!reader.EndOfSpan) {
- if (reader.TryPeak ('}')) {
- addTok (ref reader, StyleTokenType.ConstantName);
- reader.Read ();
- addTok (ref reader, StyleTokenType.ClosingBrace);
- break;
- }
- reader.Advance ();
- }
- continue;
- } else if (reader.TryPeak ('\"')) {
- addTok (ref reader, StyleTokenType.MemberValuePart);
- reader.Advance ();
- addTok (ref reader, StyleTokenType.MemberValueClose);
- break;
- }
- reader.Advance ();
- }
- curState = States.endOfStatement;
- break;
- case ';':
- reader.Advance();
- addTok (ref reader, StyleTokenType.EndOfExpression);
- curState = States.members;
- break;
- default:
- if (readName (ref reader)) {
- addTok (ref reader, StyleTokenType.Name);
- break;
- }
- reader.Advance ();
- addTok (ref reader, StyleTokenType.Unknown);
- break;
- }
-
- }
-
- return Toks.ToArray();
- }
- }
-}
+++ /dev/null
-// Copyright (c) 2021-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using CrowEditBase;
-
-namespace CECrowPlugin
-{
- public class StyleSyntaxAnalyser : SyntaxAnalyser {
- public override SyntaxNode Root => CurrentNode;
- public StyleSyntaxAnalyser (StyleDocument source) : base (source) {
- this.source = source;
- }
-
- SyntaxNode CurrentNode;
- Token previousTok;
- IEnumerator<Token> iter;
- int currentLine;
- public override void Process () {
- StyleDocument doc = source as StyleDocument;
- Exceptions = new List<SyntaxException> ();
- CurrentNode = new StyleRootSyntax (doc);
- previousTok = default;
- iter = doc.Tokens.AsEnumerable().GetEnumerator ();
- currentLine = 0;
-
- bool notEndOfSource = iter.MoveNext ();
- while (notEndOfSource) {
- if (iter.Current.Type == TokenType.LineBreak)
- currentLine++;
- else if (!iter.Current.Type.HasFlag (TokenType.Trivia)) {
- }
-
- previousTok = iter.Current;
- notEndOfSource = iter.MoveNext ();
- }
- while (currentNode.Parent != null) {
- if (!currentNode.LastTokenOffset.HasValue)
- storeCurrentNode (-1);
- else
- currentNode = currentNode.Parent;
- }
- setCurrentNodeEndLine (currentLine);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using CrowEditBase;
-
-namespace CECrowPlugin
-{
-
- public class StyleRootSyntax : SyntaxRootNode {
- public StyleRootSyntax (StyleDocument source)
- : base (source) {
- }
- }
-
- public class AttributeSyntax : SyntaxNode {
- public Token? NameToken { get; internal set; }
- public Token? EqualToken { get; internal set; }
- public Token? ValueOpenToken { get; internal set; }
- public Token? ValueCloseToken { get; internal set; }
- public Token? ValueToken { get; internal set; }
- public AttributeSyntax (int startLine, int startTok) : base (startLine, startTok) {}
- public override bool IsComplete => base.IsComplete & NameToken.HasValue & EqualToken.HasValue &
- ValueToken.HasValue & ValueOpenToken.HasValue & ValueCloseToken.HasValue;
- }
-}
\ No newline at end of file
IsVisible="{ServiceIsInError}"/>
<ListBox Style="ScrollingListBox" Data="{CrowAssemblies}"/>
<HorizontalStack Height="Fit" Width="Fit" HorizontalAlignment="Right">
- <Button Command="{CMDOptions_AddCrowAssembly}"/>
- <Button Command="{CMDOptions_AddCrowAssembly}"/>
+ <Button Command="{CMDOptions_AddCrowAssembly}" Fit="true"/>
+
</HorizontalStack>
+ <Spinner Caption="Zoom Factor" Value="{²ZoomFactor}" Minimum="0.2" Maximum="4.0" SmallIncrement="0.1" LargeIncrement="0.2"/>
<Spinner Caption="Refresh Rate (ms)" Value="{²RefreshRate}" Maximum="1000"/>
<Spinner Caption="Max Layout Try" Value="{²MaxLayoutingTries}" Maximum="1000"/>
<Spinner Caption="Max Layout Discard" Value="{²MaxDiscardCount}" Maximum="1000"/>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
- <EnableDefaultItems>false</EnableDefaultItems>
+ <EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
-
+
<ItemGroup>
<Compile Include="src\**\*.cs" />
<EmbeddedResource Include="ui\**\*.*" />
</PackageReference>
</ItemGroup>
- <ItemGroup>
+ <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.7.*" >
<IncludeAssets>all</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<Visible>False</Visible>
</PackageReference>
<!--<PackageReference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel" />-->
- </ItemGroup>
+ </ItemGroup>
</Project>
namespace CERoslynPlugin
{
- internal class CELogger : ILogger
- {
+ internal class CELogger : ILogger, IValueChange {
+ #region IValueChange implementation
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;
+ public void NotifyValueChanged (string MemberName, object _value)
+ {
+ ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value));
+ }
+ #endregion
IEventSource eventSource;
LoggerVerbosity verbosity;
MessageImportance maxMsgImportance;
set {
if (verbosity == value)
return;
- if (eventSource != null)
- unregisterHandles ();
verbosity = value;
- if (eventSource != null)
- registerHandles ();
+ NotifyValueChanged ("Verbosity", verbosity);
+ Configuration.Global.Set<Microsoft.Build.Framework.LoggerVerbosity> ("CERoslyn.LoggerVerbosity", verbosity);
+
+ switch (verbosity) {
+ case LoggerVerbosity.Minimal:
+ maxMsgImportance = MessageImportance.High;
+ break;
+ case LoggerVerbosity.Normal:
+ maxMsgImportance = MessageImportance.High;
+ break;
+ case LoggerVerbosity.Detailed:
+ maxMsgImportance = MessageImportance.Normal;
+ break;
+ case LoggerVerbosity.Diagnostic:
+ maxMsgImportance = MessageImportance.Low;
+ break;
+ }
+
}
}
public string Parameters { get; set; }
public CELogger (LoggerVerbosity verbosity = LoggerVerbosity.Detailed)
{
- this.verbosity = verbosity;
+ Verbosity = verbosity;
}
public void Initialize (IEventSource eventSource) {
this.eventSource = eventSource;
eventSource.BuildStarted += EventSource_Progress_BuildStarted;
eventSource.BuildFinished += EventSource_Progress_BuildFinished;
eventSource.MessageRaised += EventSource_MessageRaised;
-
- switch (Verbosity) {
- case LoggerVerbosity.Minimal:
- maxMsgImportance = MessageImportance.High;
-
- break;
- case LoggerVerbosity.Normal:
- maxMsgImportance = MessageImportance.Normal;
-
- eventSource.ProjectStarted += EventSource_ProjectStarted;
- eventSource.ProjectFinished += EventSource_ProjectFinished;
- break;
- case LoggerVerbosity.Detailed:
- maxMsgImportance = MessageImportance.Normal;
-
- eventSource.ProjectStarted += EventSource_ProjectStarted;
- eventSource.ProjectFinished += EventSource_ProjectFinished;
- eventSource.TargetStarted += EventSource_TargetStarted;
- eventSource.TargetFinished += EventSource_TargetFinished;
- eventSource.TaskStarted += EventSource_TaskStarted;
- eventSource.TaskFinished += EventSource_TaskFinished;
- break;
- case LoggerVerbosity.Diagnostic:
- maxMsgImportance = MessageImportance.Low;
-
- eventSource.AnyEventRaised += EventSource_AnyEventRaised;
- break;
- }
+ eventSource.ProjectStarted += EventSource_ProjectStarted;
+ eventSource.ProjectFinished += EventSource_ProjectFinished;
+ eventSource.TargetStarted += EventSource_TargetStarted;
+ eventSource.TargetFinished += EventSource_TargetFinished;
+ eventSource.TaskStarted += EventSource_TaskStarted;
+ eventSource.TaskFinished += EventSource_TaskFinished;
}
void unregisterHandles () {
eventSource.BuildStarted -= EventSource_Progress_BuildStarted;
eventSource.BuildFinished -= EventSource_Progress_BuildFinished;
eventSource.MessageRaised -= EventSource_MessageRaised;
-
- switch (Verbosity) {
- case LoggerVerbosity.Normal:
- eventSource.ProjectStarted -= EventSource_ProjectStarted;
- eventSource.ProjectFinished -= EventSource_ProjectFinished;
- break;
- case LoggerVerbosity.Detailed:
- eventSource.ProjectStarted -= EventSource_ProjectStarted;
- eventSource.ProjectFinished -= EventSource_ProjectFinished;
- eventSource.TargetStarted -= EventSource_TargetStarted;
- eventSource.TargetFinished -= EventSource_TargetFinished;
- eventSource.TaskStarted -= EventSource_TaskStarted;
- eventSource.TaskFinished -= EventSource_TaskFinished;
- break;
- case LoggerVerbosity.Diagnostic:
- eventSource.AnyEventRaised -= EventSource_AnyEventRaised;
- break;
- }
+ eventSource.ProjectStarted -= EventSource_ProjectStarted;
+ eventSource.ProjectFinished -= EventSource_ProjectFinished;
+ eventSource.TargetStarted -= EventSource_TargetStarted;
+ eventSource.TargetFinished -= EventSource_TargetFinished;
+ eventSource.TaskStarted -= EventSource_TaskStarted;
+ eventSource.TaskFinished -= EventSource_TaskFinished;
}
void log (LogType type, string message) {
string[] lines = Regex.Split (message, "\r\n|\r|\n");//|\r|\n|\\\\n");
}
private void EventSource_TaskFinished (object sender, TaskFinishedEventArgs e) {
- log (LogType.Custom1, e.Message);
+ if (Verbosity == LoggerVerbosity.Diagnostic)
+ log (LogType.Custom1, e.Message);
}
private void EventSource_TaskStarted (object sender, TaskStartedEventArgs e) {
- log (LogType.Custom1, e.Message);
+ if (Verbosity == LoggerVerbosity.Diagnostic)
+ log (LogType.Custom1, e.Message);
}
private void EventSource_TargetFinished (object sender, TargetFinishedEventArgs e) {
- log (LogType.Custom2, e.Message);
+ if (Verbosity >= LoggerVerbosity.Detailed)
+ log (LogType.Custom2, e.Message);
}
private void EventSource_TargetStarted (object sender, TargetStartedEventArgs e) {
- log (LogType.Custom2, e.Message);
+ if (Verbosity >= LoggerVerbosity.Detailed)
+ log (LogType.Custom2, e.Message);
}
private void EventSource_MessageRaised (object sender, BuildMessageEventArgs e) {
- if (e.Importance > maxMsgImportance)
+ if (Verbosity == LoggerVerbosity.Quiet || e.Importance > maxMsgImportance)
return;
if (e.Importance == MessageImportance.High)
log (LogType.High, e.Message);
else
log (LogType.Low, e.Message);
}
- private void EventSource_AnyEventRaised (object sender, BuildEventArgs e) {
- if (e is BuildErrorEventArgs ||
- e is BuildWarningEventArgs ||
- e is BuildStartedEventArgs ||
- e is BuildMessageEventArgs ||
- e is BuildFinishedEventArgs)
- return;
- else if (e is TargetFinishedEventArgs || e is TargetStartedEventArgs)
- log (LogType.Custom2, e.Message);
- else if (e is TaskStartedEventArgs || e is TaskFinishedEventArgs)
- log (LogType.Custom1, e.Message);
- else if (e is BuildStatusEventArgs)
- log (LogType.High, e.Message);
- else
- log (LogType.Custom3, e.Message);
- }
-
void EventSource_ProjectStarted (object sender, ProjectStartedEventArgs e)
{
log (LogType.Custom3, e.Message);
using Project = CrowEditBase.Project;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
+using System.Threading.Tasks;
namespace CERoslynPlugin
{
public CommandGroup CMDSBuild { get; private set; }
public Command CMDSetAsStartupProject { get; private set; }
+ BuildResult lastBuildResult;
internal MSBuildProject (SolutionProject solution, ProjectInSolution projectInSolution) : base (projectInSolution.AbsolutePath) {
this.projectInSolution = projectInSolution;
Console.WriteLine (ex);
}
}
- void printEvaluatedProperties (ProjectInstance pi) {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine ($"Evaluated Globals properties for {Name}");
- foreach (ProjectPropertyInstance item in pi.Properties.OrderBy (p => p.Name)) {
- Console.ForegroundColor = ConsoleColor.White;
- Console.Write ($"\t{item.Name,-40} = ");
- Console.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine ($"{item.EvaluatedValue}");
- }
- ICollection<ProjectItemInstance> pii = pi.GetItems ("InnerOutput");
- ProjectRootElement pre = pi.ToProjectRootElement();
- pre.FullPath = "/home/jp/test.csproj";
- pre.Save();
-
- }
public override void Unload () {
CMDSBuild.ToggleAllCommand (false);
if (commands.Contains (CMDSetAsStartupProject))
BuildRequestData request = new BuildRequestData (pi, targets, null,
BuildRequestDataFlags.ProvideProjectStateAfterBuild);
- BuildResult result = BuildManager.DefaultBuildManager.Build (solutionProject.buildParams, request);
+ lastBuildResult = BuildManager.DefaultBuildManager.Build (solutionProject.buildParams, request);
- printEvaluatedProperties (result.ProjectStateAfterBuild);
+ printEvaluatedProperties (lastBuildResult.ProjectStateAfterBuild);
- var test = result.ProjectStateAfterBuild.GetItems ("Reference");
+ var test = lastBuildResult.ProjectStateAfterBuild.GetItems ("Reference");
+
+ Console.WriteLine (IsCrowProject);
//}
}
+ public async void DesignBuild () {
+ lastBuildResult = await Task.Run (()=> designBuild());
+ }
+ BuildResult designBuild () {
+ string[] targets = {"Build"};
+ BuildManager.DefaultBuildManager.ResetCaches ();
+ ProjectInstance pi = BuildManager.DefaultBuildManager.GetProjectInstanceForBuild (project);
+ BuildRequestData request = new BuildRequestData (pi, targets, null,
+ BuildRequestDataFlags.ProvideProjectStateAfterBuild);
+ return BuildManager.DefaultBuildManager.Build (solutionProject.buildParams, request);
+ }
public override string Icon {
get {
switch (Path.GetExtension (FullPath)) {
public bool IsCrowProject {
get {
- foreach (ProjectItemNode reference in Childs[0].Flatten.OfType<ProjectItemNode>()) {
+ /*foreach (ProjectItemNode reference in Childs[0].Flatten.OfType<ProjectItemNode>()) {
switch (reference.NodeType) {
case NodeType.PackageReference:
if (reference.Caption == "Crow")
return true;
break;
}
+ }*/
+ if (lastBuildResult != null) {
+ var references = lastBuildResult.ProjectStateAfterBuild.GetItems ("Reference");
+ return references.Any (r=>r.GetMetadataValue("PackageName") == "Crow");
}
return false;
}
}
- public bool IsStartupProject => solutionProject.StartupProject == this;
+ public override string StatusIcon => solutionProject.StartupProject == this ? "#icons.startup.svg" : null;
public override bool ContainsFile (string fullPath) =>
Flatten.OfType<ProjectItemNode> ().Any (f => f.FullPath == fullPath);
}
return null;
}
+
+
+#region debug
+ void printEvaluatedProperties (ProjectInstance pi) {
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine ($"Evaluated Globals properties for {Name}");
+ foreach (ProjectPropertyInstance item in pi.Properties.OrderBy (p => p.Name)) {
+ Console.ForegroundColor = ConsoleColor.White;
+ Console.Write ($"\t{item.Name,-40} = ");
+ Console.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine ($"{item.EvaluatedValue}");
+
+ }
+ ICollection<ProjectItemInstance> pii = pi.GetItems ("InnerOutput");
+ ProjectRootElement pre = pi.ToProjectRootElement();
+ pre.FullPath = "/home/jp/test.csproj";
+ pre.Save();
+
+ }
+#endregion
}
}
\ No newline at end of file
namespace CERoslynPlugin
{
public class RoslynService : Service {
- internal CELogger Logger { get; private set; }
- public LogLevel LogLevel {
+ CELogger logger;
+ internal CELogger Logger {
+ get => logger;
+ private set {
+ if (logger == value)
+ return;
+ logger = value;
+ NotifyValueChanged (logger);
+ }
+ }
+ /*public LogLevel LogLevel {
get => Crow.Configuration.Global.Get<LogLevel>("LogLevel");
set {
if (LogLevel == value)
Logger.Verbosity = Microsoft.Build.Framework.LoggerVerbosity.Diagnostic;
break;
}
- }
+ }*/
public RoslynService () : base () {
configureDefaultSDKPathes ();
}
public override void Start() {
- Logger = new CELogger ();
- updateLogLevel ();
+ Logger = new CELogger (
+ Configuration.Global.Get<Microsoft.Build.Framework.LoggerVerbosity> ("CERoslyn.LoggerVerbosity",
+ Microsoft.Build.Framework.LoggerVerbosity.Normal));
+ //updateLogLevel ();
Environment.SetEnvironmentVariable ("MSBUILD_EXE_PATH", Path.Combine (MSBuildRoot, "MSBuild.dll"));
Environment.SetEnvironmentVariable ("MSBuildSDKsPath", Path.Combine (MSBuildRoot, "Sdks"));
Load();
- if (Flatten.OfType<MSBuildProject>().Any (msb => msb.IsCrowProject)) {
+ if (FlattenProjetcs.OfType<MSBuildProject>().Any (msb => msb.IsCrowProject)) {
Console.WriteLine ("Is crow project!!");
}
}
}*/
}
public override bool ContainsFile (string fullPath) =>
- FlattenSubProjetcs.Any (f => f.ContainsFile (fullPath));
+ FlattenProjetcs.Any (f => f.ContainsFile (fullPath));
public override string Name => Path.GetFileNameWithoutExtension (FullPath);
public override string Icon => "#icons.file_type_sln2.svg";
public Project StartupProject {
- get => FlattenSubProjetcs.FirstOrDefault (p => p.FullPath == UserConfig.Get<string> ("StartupProject"));
+ get => FlattenProjetcs.FirstOrDefault (p => p.FullPath == UserConfig.Get<string> ("StartupProject"));
set {
if (value == StartupProject)
return;
- StartupProject?.NotifyValueChanged ("IsStartupProject", false);
+ StartupProject?.NotifyValueChanged ("StatusIcon", (object)StartupProject?.StatusIcon);
if (value == null)
UserConfig.Set ("StartupProject", "");
else {
UserConfig.Set ("StartupProject", value.FullPath);
- value.NotifyValueChanged("IsStartupProject", true);
+ value.NotifyValueChanged ("StatusIcon", (object)value.StatusIcon);
}
NotifyValueChanged ("StartupProject", StartupProject);
}
}
public override NodeType NodeType => NodeType.ProjectGroup;
+ public override IEnumerable<Project> FlattenProjetcs {
+ get {
+ foreach (var node in SubProjetcs.SelectMany (sp => sp.FlattenProjetcs))
+ yield return node;
+ }
+ }
public override void Load () {
Dictionary<string,string> globalProperties = new Dictionary<string, string>();
LogInitialPropertiesAndItems = true,
LogTaskInputs = true,
UseSynchronousLogging = true,
- ResetCaches = true
+ ResetCaches = true,
+ DetailedSummary = true
};
//projectCollection.IsBuildEnabled = false;
}
IsLoaded = true;
+
+ if (StartupProject is MSBuildProject msbProj)
+ msbProj?.DesignBuild();
}
void build (params string[] targets) {
<Image Style="TreeIcon"
Path="{Icon}" SvgSub="{IconSub}"/>
<Label Style="TreeLabel" Text="{./Caption}"/>
- <Image Style="TreeIconSmall" Path="#icons.startup.svg" IsVisible="{IsStartupProject}"/>
+ <Image Style="TreeIconSmall" Path="#icons.startup.svg" IsVisible="{IsStartupProject}"/>
</HorizontalStack>
</ListItem>
<Container Name="Content" Visible="false"/>
<TextBox Width="Stretched" Text="{²MSBuildRoot}"/>
<Button Command="{CMDOptions_SelectMSBuildRoot}" MinimumSize="0,0"/>
</HorizontalStack>
- <EnumSelector Caption="Log Level" EnumValue="{²LogLevel}" />
+ <EnumSelector DataSource="{Logger}" Caption="Log Level" EnumValue="{²Verbosity}" />
</VerticalStack>
</DockWindow>
addTok (ref reader, XmlTokenType.ElementOpen);
if (readName (ref reader)) {
addTok (ref reader, XmlTokenType.ElementName);
- curState = States.StartTag;
}
+ curState = States.StartTag;
}
break;
case '?':
case '"':
char q = reader.Read();
addTok (ref reader, XmlTokenType.AttributeValueOpen);
- if (reader.TryReadUntil (q)) {
- addTok (ref reader, XmlTokenType.AttributeValue);
- reader.Advance ();
- addTok (ref reader, XmlTokenType.AttributeValueClose);
- } else
- addTok (ref reader, XmlTokenType.AttributeValue);
+ while (!reader.EndOfSpan) {
+ if (reader.Eol()) {
+ addTok (ref reader, XmlTokenType.AttributeValue);
+ reader.ReadEol();
+ addTok (ref reader, XmlTokenType.LineBreak);
+ continue;
+ }
+ if (reader.TryPeak (q)) {
+ addTok (ref reader, XmlTokenType.AttributeValue);
+ reader.Advance (1);
+ addTok (ref reader, XmlTokenType.AttributeValueClose);
+ break;
+ } else
+ reader.Read ();
+ }
break;
case '=':
reader.Advance();
base.OnInitialized ();
loadPlugins ();
- reopenLastProjectList ();
SetWindowIcon ("#Crow.Icons.crow.png");
reloadWinConfigs ();
+ reopenLastProjectList ();
+
reopenLastDocumentList ();
}
public override void Terminate()
<MenuItem Data="{Commands}" Width="Fit" IsEnabled="{CanExecute}"
ItemTemplate="#ui.MenuItem.itmp">
<Template>
- <Popper PopDirection="Bottom" Caption="{Caption}" Width="Fit"
+ <Popper PopDirection="Bottom" Caption="{Caption}" Width="Fit"
MouseEnter="{Background=${ControlHighlight}}"
MouseLeave="{Background=Transparent}">
<Template>
</Popper>
</Template>
</MenuItem>
- </ItemTemplate>
+ </ItemTemplate>
</Menu>
<DockStack Name="mainDock" RootDataLevel="true" Background="DarkGrey"/>
</VerticalStack>
</ItemTemplate>
<!--<ItemTemplate DataType="CERoslynPlugin.MSBuildProject" Data="Childs" Path="#CERoslynPlugin.ui.MSBuildProjectNode.template" />-->
- <ItemTemplate DataType="CrowEditBase.VirtualNode" Data="Childs" Path="#ui.TreeExpandable.template" />
+ <ItemTemplate DataType="CrowEditBase.VirtualNode" Data="Childs" Path="#ui.TreeExpandable.template" />
<ItemTemplate DataType="CrowEditBase.Project" Data="Childs" Path="#ui.TreeExpandable.template" />
+
<!--<ItemTemplate DataType="CrowEditBase.TreeNode" DataTest="NodeType" Data="Childs" Path="#ui.TreeExpandable.template" />-->
</TreeView>
</DockWindow>