public static void BuildCompletionData(Document EditorDocument, IAbstractSyntaxTree SyntaxTree, CodeCompletionContext ctx, CompletionDataList l, char triggerChar) { var deltaOffset = (char.IsLetter(triggerChar) || triggerChar == '_' || triggerChar == '@') ? 1 : 0; var caretOffset = ctx.TriggerOffset - deltaOffset; var caretLocation = new CodeLocation(ctx.TriggerLineOffset - deltaOffset, ctx.TriggerLine); var codeCache = EnumAvailableModules(EditorDocument); var edData = new EditorData { CaretLocation = caretLocation, CaretOffset = caretOffset, ModuleCode = EditorDocument.Editor.Text, SyntaxTree = SyntaxTree as DModule, ParseCache = codeCache, Options = DCompilerService.Instance.CompletionOptions }; AbstractCompletionProvider.BuildCompletionData( new CompletionDataGenerator { CompletionDataList = l }, edData, triggerChar == '\0'?null:triggerChar.ToString()); }
public void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr) { DModule ast = null; if (!_modules.TryGetValue(filename, out ast)) { throw new COMException("module not found", 1); } CodeLocation loc = new CodeLocation((int)idx + 1, (int)line); _editorData.SyntaxTree = ast as DModule; _editorData.ModuleCode = _sources[filename]; _editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, loc); // step back to beginning of identifier while (_editorData.CaretOffset > 0 && isIdentifierCharacter(_editorData.ModuleCode[_editorData.CaretOffset - 1])) { _editorData.CaretOffset--; if (idx > 0) { idx--; } } _editorData.CaretLocation = new CodeLocation((int)idx + 1, (int)line); VDServerCompletionDataGenerator cdgen = new VDServerCompletionDataGenerator(tok); AbstractCompletionProvider provider = AbstractCompletionProvider.BuildCompletionData(cdgen, _editorData, null); //tok _expansions = cdgen.expansions; }
public static void BuildCompletionData(DEditorDocument EditorDocument, IList <ICompletionData> l, string EnteredText, out string lastResultPath) { lastResultPath = null; var provider = AbstractCompletionProvider.BuildCompletionData(new IDECompletionDataGenerator(l), EditorDocument, EnteredText); }
public static void BuildCompletionData(Document EditorDocument, IAbstractSyntaxTree SyntaxTree, CodeCompletionContext ctx, CompletionDataList l, char triggerChar) { bool removeChar = char.IsLetter(triggerChar) || triggerChar == '_' || triggerChar == '@'; var deltaOffset = 0; //removeChar ? 1 : 0; var caretOffset = ctx.TriggerOffset - (removeChar ? 1 : 0); var caretLocation = new CodeLocation(ctx.TriggerLineOffset - deltaOffset, ctx.TriggerLine); var codeCache = EnumAvailableModules(EditorDocument); var ed = new EditorData { CaretLocation = caretLocation, CaretOffset = caretOffset, ModuleCode = removeChar ? EditorDocument.Editor.Text.Remove(ctx.TriggerOffset - 1, 1) : EditorDocument.Editor.Text, SyntaxTree = SyntaxTree as DModule, ParseCache = codeCache, Options = DCompilerService.Instance.CompletionOptions }; if (EditorDocument.HasProject) { var cfg = EditorDocument.Project.GetConfiguration(Ide.IdeApp.Workspace.ActiveConfiguration) as DProjectConfiguration; if (cfg != null) { ed.GlobalDebugIds = cfg.CustomDebugIdentifiers; ed.IsDebug = cfg.DebugMode; ed.DebugLevel = cfg.DebugLevel; ed.GlobalVersionIds = cfg.GlobalVersionIdentifiers; double d; int v; if (Double.TryParse(EditorDocument.Project.Version, out d)) { ed.VersionNumber = (int)d; } else if (Int32.TryParse(EditorDocument.Project.Version, out v)) { ed.VersionNumber = v; } } } if (ed.GlobalVersionIds == null) { ed.GlobalVersionIds = VersionIdEvaluation.GetOSAndCPUVersions(); } AbstractCompletionProvider.BuildCompletionData( new CompletionDataGenerator { CompletionDataList = l }, ed, triggerChar == '\0'?null:triggerChar.ToString()); }
public static void BuildCompletionData(Document EditorDocument, DModule SyntaxTree, CodeCompletionContext ctx, CompletionDataList l, char triggerChar) { AbstractCompletionProvider.BuildCompletionData( new CompletionDataGenerator { CompletionDataList = l }, DResolverWrapper.CreateEditorData(EditorDocument, SyntaxTree as DModule, ctx, triggerChar), triggerChar == '\0'?null:triggerChar.ToString()); }
public void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr) { IAbstractSyntaxTree ast = null; if (!_modules.TryGetValue(filename, out ast)) { throw new COMException("module not found", 1); } CodeLocation loc = new CodeLocation((int)idx, (int)line); EditorData editorData = new EditorData(); editorData.CaretLocation = loc; editorData.SyntaxTree = ast as DModule; editorData.ModuleCode = _sources[filename]; editorData.CaretOffset = getCodeOffset(editorData.ModuleCode, loc); VDServerCompletionDataGenerator cdgen = new VDServerCompletionDataGenerator(); AbstractCompletionProvider provider = AbstractCompletionProvider.BuildCompletionData(cdgen, editorData, tok); _expansions = cdgen.expansions; //MessageBox.Show("GetSemanticExpansions()"); //throw new NotImplementedException(); }