Changeset 11816


Ignore:
Timestamp:
01/21/15 18:59:34 (6 years ago)
Author:
jkarder
Message:

#2077:

  • added parsing helpers
  • minor code changes
Location:
trunk/sources/HeuristicLab.CodeEditor/3.4
Files:
1 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CodeEditor/3.4/HeuristicLab.CodeEditor-3.4.csproj

    r11804 r11816  
    156156    <Compile Include="LanguageFeatures\CodeCompletion\CSharp\CSharpCodeCompletionContext.cs" />
    157157    <Compile Include="LanguageFeatures\CodeCompletion\CSharp\CSharpCodeCompletionDataFactory.cs" />
    158     <Compile Include="LanguageFeatures\CodeCompletion\CSharp\CSharpCodeCompletionHelpers.cs" />
     158    <Compile Include="LanguageFeatures\Helpers\CSharpParsingHelpers.cs" />
    159159    <Compile Include="LanguageFeatures\CodeCompletion\CSharp\CompletionData\EntityCompletionData.cs" />
    160160    <Compile Include="LanguageFeatures\CodeCompletion\CSharp\CompletionData\ImportCompletionData.cs" />
  • trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionContext.cs

    r11800 r11816  
    4646      this.offset = offset;
    4747
    48       var unresolvedFile = CSharpCodeCompletionHelpers.CreateCSharpUnresolvedFile(this.document);
     48      var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(this.document);
    4949      this.projectContent = projectContent.AddOrUpdateFiles(unresolvedFile);
    5050
  • trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs

    r11802 r11816  
    5656        completionContext.ProjectContent,
    5757        completionContext.TypeResolveContextAtCaret
    58       ) { EolMarker = Environment.NewLine };
     58        );
    5959
    6060      char completionChar = completionContext.Document.GetCharAt(completionContext.Offset - 1);
     
    119119      );
    120120
    121       var unresolvedFile = CSharpCodeCompletionHelpers.CreateCSharpUnresolvedFile(document);
     121      var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(document);
    122122      projectContent = projectContent.AddOrUpdateFiles(unresolvedFile);
    123123    }
  • trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeFolding/CSharp/CSharpCodeFoldingContext.cs

    r11700 r11816  
    2525namespace HeuristicLab.CodeEditor {
    2626  internal class CSharpCodeFoldingContext {
    27     public readonly IDocument Document;
    28     public readonly SyntaxTree SyntaxTree;
     27    private readonly IDocument document;
     28    public IDocument Document { get { return document; } }
     29
     30    private readonly SyntaxTree syntaxTree;
     31    public SyntaxTree SyntaxTree { get { return syntaxTree; } }
    2932
    3033    public CSharpCodeFoldingContext(IDocument document) {
    31       Document = new ReadOnlyDocument(document, document.FileName);
    32 
    33       var parser = new CSharpParser();
    34       var syntaxTree = parser.Parse(document, document.FileName);
    35       syntaxTree.Freeze();
    36 
    37       SyntaxTree = syntaxTree;
     34      this.document = new ReadOnlyDocument(document, document.FileName);
     35      syntaxTree = CSharpParsingHelpers.CreateSyntaxTree(this.document);
    3836    }
    3937  }
  • trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/Helpers/CSharpParsingHelpers.cs

    r11813 r11816  
    2525
    2626namespace HeuristicLab.CodeEditor {
    27   internal class CSharpCodeCompletionHelpers {
    28     public static CSharpUnresolvedFile CreateCSharpUnresolvedFile(IDocument document) {
     27  internal class CSharpParsingHelpers {
     28    public static SyntaxTree CreateSyntaxTree(IDocument document) {
    2929      var parser = new CSharpParser();
    3030      var syntaxTree = parser.Parse(document, document.FileName);
     31      return syntaxTree;
     32    }
     33
     34    public static CSharpUnresolvedFile CreateCSharpUnresolvedFile(IDocument document) {
     35      var syntaxTree = CreateSyntaxTree(document);
    3136      syntaxTree.Freeze();
    32       return syntaxTree.ToTypeSystem();
     37      var unresolvedFile = syntaxTree.ToTypeSystem();
     38      return unresolvedFile;
    3339    }
    3440  }
Note: See TracChangeset for help on using the changeset viewer.