Skip to content

Commit 6ed2415

Browse files
committed
- Updated syntaxer with full autoclass support
1 parent c162caa commit 6ed2415

File tree

16 files changed

+19
-13
lines changed

16 files changed

+19
-13
lines changed

src/CSScriptIntellisense/CSharpIntellisense/CSScriptHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ static public Tuple<string[], string[]> GetProjectFiles(string script)
240240
static public bool NeedsAutoclassWrapper(string text)
241241
{
242242
return Regex.Matches(text, @"\s?//css_args\s+/ac(,|;|\s+)").Count != 0
243+
|| Regex.Matches(text, @"\s?//css_autoclass\s+").Count != 0
243244
|| Regex.Matches(text, @"\s?//css_ac\s+").Count != 0;
244245
}
245246

512 Bytes
Binary file not shown.

src/CSScriptIntellisense/CSharpIntellisense/SimpleCodeCompletion.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,29 @@ public static void ResetProject(Tuple<string, string>[] sourceFiles = null, para
154154
//----------------------------------
155155
public static CodeMapItem[] GetMapOf(string code, string codeFile)
156156
{
157-
bool injected = CSScriptHelper.DecorateIfRequired(ref code);
158157
CodeMapItem[] map;
159158

160159
if (Config.Instance.UsingRoslyn)
160+
{
161161
map = Syntaxer.GetMapOf(code, codeFile);
162+
}
162163
else
164+
{
165+
bool injected = CSScriptHelper.DecorateIfRequired(ref code);
163166
map = MonoEngine.GetMapOf(code, injected, codeFile);
164167

165-
if (injected)
166-
{
167-
int injectedLineOffset = CSScriptHelper.GetDecorationInfo(code).Item1;
168-
int injectedLineNumber = code.Substring(0, injectedLineOffset).Split('\n').Count();
168+
if (injected)
169+
{
170+
int injectedLineOffset = CSScriptHelper.GetDecorationInfo(code).Item1;
171+
int injectedLineNumber = code.Substring(0, injectedLineOffset).Split('\n').Count();
169172

170-
map = map.Where(i => i.Line != injectedLineNumber).ToArray();
173+
map = map.Where(i => i.Line != injectedLineNumber).ToArray();
171174

172-
foreach (CodeMapItem item in map)
173-
{
174-
if (item.Line >= injectedLineNumber)
175-
item.Line -= 1;
175+
foreach (CodeMapItem item in map)
176+
{
177+
if (item.Line >= injectedLineNumber)
178+
item.Line -= 1;
179+
}
176180
}
177181
}
178182
return map;

src/CSScriptNpp.Test/Editor.Tests/CodeMap.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ void main2(int test, int test2) {}
8282
Assert.Equal("System.IO", items[1]);
8383
}
8484

85-
[Fact]
85+
[Fact(Skip = "Reflector is no longer in use")]
86+
8687
public void AutoClassClass()
8788
{
8889
string code =
8990
@"//css_inc test.cs
90-
//css_args /ac
91+
//css_ac
9192
using System;
9293
using System.Linq;
9394
using System.Data;

src/CSScriptNpp/CSScriptNpp/CSScriptHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,7 @@ public static string RemoveNonUserCompilingInfo(this string compilerOutput)
13531353
.Replace("vbc : Command line (0,0): warning BC2007: unrecognized option 'warn:0'; ignored", "");
13541354
}
13551355

1356+
13561357
public static IEnumerable<T> Concat<T>(this IEnumerable<T> collection, T item)
13571358
{
13581359
return collection.Concat(new[] { item });
0 Bytes
Binary file not shown.
2.5 KB
Binary file not shown.
1.5 KB
Binary file not shown.
4 KB
Binary file not shown.
4 KB
Binary file not shown.

0 commit comments

Comments
 (0)