-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditorwindow.cpp
More file actions
57 lines (48 loc) · 1.74 KB
/
editorwindow.cpp
File metadata and controls
57 lines (48 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "stdafx.h"
#include <atldlgs.h>
#include <atlpath.h>
#include "resource.h"
#include "EditorWnd.h"
#include "AboutDlg.h"
#include "MainFrm.h"
void EditorWindow::ShowAutoComplete()
{
int pos = SendMessage(SCI_GETCURRENTPOS, 0, 0);
int start = SendMessage(SCI_WORDSTARTPOSITION, pos, TRUE);
int len = pos - start;
if (len <= 0) return;
char buf[128] = { 0 };
Sci_TextRange tr;
tr.chrg.cpMin = start;
tr.chrg.cpMax = pos;
tr.lpstrText = buf;
SendMessage(SCI_GETTEXTRANGE, 0, (LPARAM)&tr);
CString lang = m_pFrame->GetLanguage();
std::string list;
if (!lang.CompareNoCase(_T("vbscript"))) {
list = BuildAutoList(buf);
if (!list.empty())
SendMessage(SCI_AUTOCSHOW, len, (LPARAM)list.c_str());
}
else if (!lang.CompareNoCase(_T("jscript"))) {
const char* jsKeywords =
"break case catch class const continue debugger default delete do else export extends "
"finally for function if import in instanceof let new return super switch this throw "
"try typeof var void while with yield await async "
"true false null undefined "
"Array Boolean Date Error Function JSON Math Number Object RegExp String Symbol Map Set WeakMap WeakSet "
"console window document globalThis Promise Reflect Proxy Intl";
SendMessage(SCI_AUTOCSETIGNORECASE, true, 0);
SendMessage(SCI_AUTOCSETSEPARATOR, ' ', 0);
SendMessage(SCI_AUTOCSETMAXHEIGHT, 12, 0);
SendMessage(SCI_AUTOCSETMAXWIDTH, 50, 0);
list = BuildAutoListJScript(buf,jsKeywords);
if (!list.empty())
SendMessage(SCI_AUTOCSHOW, len, (LPARAM)list.c_str());
}
else if (!lang.CompareNoCase(_T("python"))) {
list = BuildAutoListPython(buf);
if (!list.empty())
SendMessage(SCI_AUTOCSHOW, len, (LPARAM)list.c_str());
}
}