@@ -26,32 +26,33 @@ public class FileContext
26
26
#region Properties
27
27
28
28
/// <summary>
29
- /// Gets the filesystem path of the file.
29
+ /// Gets the parsed abstract syntax tree for the file.
30
30
/// </summary>
31
- public string Path
31
+ public Ast Ast
32
32
{
33
- get { return this . scriptFile . FilePath ; }
33
+ get { return this . scriptFile . ScriptAst ; }
34
34
}
35
35
36
36
/// <summary>
37
- /// Gets the workspace-relative path of the file.
37
+ /// Gets a BufferRange which represents the entire content
38
+ /// range of the file.
38
39
/// </summary>
39
- public string WorkspacePath
40
+ public BufferRange FileRange
40
41
{
41
- get
42
- {
43
- return
44
- this . editorOperations . GetWorkspaceRelativePath (
45
- this . scriptFile . FilePath ) ;
46
- }
42
+ get { return this . scriptFile . FileRange ; }
47
43
}
48
44
49
45
/// <summary>
50
- /// Gets the parsed abstract syntax tree for the file.
46
+ /// Gets the language of the file.
51
47
/// </summary>
52
- public Ast Ast
48
+ public string Language { get ; private set ; }
49
+
50
+ /// <summary>
51
+ /// Gets the filesystem path of the file.
52
+ /// </summary>
53
+ public string Path
53
54
{
54
- get { return this . scriptFile . ScriptAst ; }
55
+ get { return this . scriptFile . FilePath ; }
55
56
}
56
57
57
58
/// <summary>
@@ -63,12 +64,16 @@ public Token[] Tokens
63
64
}
64
65
65
66
/// <summary>
66
- /// Gets a BufferRange which represents the entire content
67
- /// range of the file.
67
+ /// Gets the workspace-relative path of the file.
68
68
/// </summary>
69
- public BufferRange FileRange
69
+ public string WorkspacePath
70
70
{
71
- get { return this . scriptFile . FileRange ; }
71
+ get
72
+ {
73
+ return
74
+ this . editorOperations . GetWorkspaceRelativePath (
75
+ this . scriptFile . FilePath ) ;
76
+ }
72
77
}
73
78
74
79
#endregion
@@ -81,14 +86,22 @@ public BufferRange FileRange
81
86
/// <param name="scriptFile">The ScriptFile to which this file refers.</param>
82
87
/// <param name="editorContext">The EditorContext to which this file relates.</param>
83
88
/// <param name="editorOperations">An IEditorOperations implementation which performs operations in the editor.</param>
89
+ /// <param name="language">Determines the language of the file.false If it is not specified, then it defaults to "Unknown"</param>
84
90
public FileContext (
85
91
ScriptFile scriptFile ,
86
92
EditorContext editorContext ,
87
- IEditorOperations editorOperations )
93
+ IEditorOperations editorOperations ,
94
+ string language = "Unknown" )
88
95
{
96
+ if ( string . IsNullOrWhiteSpace ( language ) )
97
+ {
98
+ language = "Unknown" ;
99
+ }
100
+
89
101
this . scriptFile = scriptFile ;
90
102
this . editorContext = editorContext ;
91
103
this . editorOperations = editorOperations ;
104
+ this . Language = language ;
92
105
}
93
106
94
107
#endregion
0 commit comments