~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/ILanguageCompletionBuilder.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
// THE SOFTWARE.
26
26
 
27
27
using System;
28
 
using System.Linq;
29
28
using System.Collections.Generic;
30
 
using System.Diagnostics;
31
 
using MonoDevelop.Core;
32
 
using MonoDevelop.Projects;
33
 
using MonoDevelop.Ide.Gui.Content;
34
 
using MonoDevelop.AspNet;
35
29
using MonoDevelop.AspNet.Parser;
36
 
using MonoDevelop.AspNet.Parser.Dom;
37
 
using MonoDevelop.Html;
38
 
using MonoDevelop.DesignerSupport;
39
30
using S = MonoDevelop.Xml.StateEngine;
40
31
using MonoDevelop.AspNet.StateEngine;
41
 
using System.Text;
42
32
using Mono.TextEditor;
43
33
using MonoDevelop.Ide.TypeSystem;
44
34
using ICSharpCode.NRefactory.TypeSystem;
45
35
using MonoDevelop.Ide.CodeCompletion;
46
 
using ICSharpCode.NRefactory.Completion;
47
36
 
48
37
namespace MonoDevelop.AspNet.Gui
49
38
{
104
93
                        this.AspNetDocument = aspNetParsedDocument;
105
94
                        this.Imports = imports;
106
95
                        this.References = references;
107
 
                        ScriptBlocks = new List<TagNode> ();
108
 
                        Expressions = new List<ExpressionNode> ();
109
 
                        aspNetParsedDocument.RootNode.AcceptVisit (new ExpressionCollector (this));
 
96
                        BuildExpressionAndScriptsLists ();
110
97
                }
111
98
                
112
99
                public ICompilation Dom { get; private set; }
113
100
                public AspNetParsedDocument AspNetDocument { get; private set; }
114
101
                public ParsedDocument ParsedDocument { get; set; }
115
 
                public List<ExpressionNode> Expressions { get; private set; }
116
 
                public List<TagNode> ScriptBlocks { get; private set; }
117
102
                public IList<ICompilation> References { get; set; }
118
103
                public IEnumerable<string> Imports { get; private set; }
119
104
                
146
131
                        throw new InvalidOperationException (string.Format ("Unexpected filetype '{0}'", type));
147
132
                }
148
133
                
149
 
                class ExpressionCollector : Visitor
 
134
                #region parsing for expression and runat="server" script tags
 
135
                
 
136
                public List<S.XNode> XExpressions { get; private set; }
 
137
                public List<S.XElement> XScriptBlocks { get; private set; }
 
138
                
 
139
                void BuildExpressionAndScriptsLists ()
150
140
                {
151
 
                        DocumentInfo parent;
152
 
                        
153
 
                        public ExpressionCollector (DocumentInfo parent)
154
 
                        {
155
 
                                this.parent = parent;
156
 
                        }
157
 
                        
158
 
                        public override void Visit (TagNode node)
159
 
                        {
160
 
                                if (node.TagName == "script" && (string)node.Attributes["runat"] == "server")
161
 
                                        parent.ScriptBlocks.Add (node);
162
 
                        }
163
 
                        
164
 
                        public override void Visit (ExpressionNode node)
165
 
                        {
166
 
                                parent.Expressions.Add (node);
 
141
                        XExpressions = new List<S.XNode> ();
 
142
                        XScriptBlocks = new List<S.XElement> ();
 
143
                        
 
144
                        foreach (S.XNode node in AspNetDocument.XDocument.AllDescendentNodes) {
 
145
                                if (node is AspNetRenderExpression || node is AspNetHtmlEncodedExpression || node is AspNetRenderBlock) {
 
146
                                        XExpressions.Add (node);
 
147
                                        continue;
 
148
                                }
 
149
                                S.XElement el = node as S.XElement;
 
150
                                if (el == null) {
 
151
                                        continue;
 
152
                                }
 
153
                                if (el.IsServerScriptTag ()) {
 
154
                                        XScriptBlocks.Add (el); 
 
155
                                }
167
156
                        }
168
157
                }
 
158
                
 
159
                #endregion
169
160
        }
170
161
        
171
162
        /// <summary>
183
174
                
184
175
                ICompletionDataList HandlePopupCompletion (MonoDevelop.Ide.Gui.Document realDocument, DocumentInfo info, LocalDocumentInfo localInfo);
185
176
                ICompletionDataList HandleCompletion (MonoDevelop.Ide.Gui.Document realDocument, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char currentChar, ref int triggerWordLength);
186
 
                IParameterDataProvider HandleParameterCompletion (MonoDevelop.Ide.Gui.Document realDocument, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char completionChar);
 
177
                ParameterDataProvider HandleParameterCompletion (MonoDevelop.Ide.Gui.Document realDocument, CodeCompletionContext completionContext, DocumentInfo info, LocalDocumentInfo localInfo, char completionChar);
187
178
                bool GetParameterCompletionCommandOffset (MonoDevelop.Ide.Gui.Document realDocument, DocumentInfo info, LocalDocumentInfo localInfo, out int cpos);
188
179
        }
189
180