-
Notifications
You must be signed in to change notification settings - Fork 27
Add Delphi 10.2 Tokyo support via dedicated client and tool frame #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <ProjectGuid>{E13F5E64-5BEF-4919-9E81-0DFCBA69E1B4}</ProjectGuid> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Projects Include="source\DelphiLintClient250.dproj"> | ||
| <Dependencies/> | ||
| </Projects> | ||
| <Projects Include="test\DelphiLintClientTest250.dproj"> | ||
| <Dependencies/> | ||
| </Projects> | ||
| </ItemGroup> | ||
| <ProjectExtensions> | ||
| <Borland.Personality>Default.Personality.12</Borland.Personality> | ||
| <Borland.ProjectType/> | ||
| <BorlandProject> | ||
| <Default.Personality/> | ||
| </BorlandProject> | ||
| </ProjectExtensions> | ||
| <Target Name="DelphiLintClient250"> | ||
| <MSBuild Projects="source\DelphiLintClient250.dproj"/> | ||
| </Target> | ||
| <Target Name="DelphiLintClient250:Clean"> | ||
| <MSBuild Projects="source\DelphiLintClient250.dproj" Targets="Clean"/> | ||
| </Target> | ||
| <Target Name="DelphiLintClient250:Make"> | ||
| <MSBuild Projects="source\DelphiLintClient250.dproj" Targets="Make"/> | ||
| </Target> | ||
| <Target Name="DelphiLintClientTest250"> | ||
| <MSBuild Projects="test\DelphiLintClientTest250.dproj"/> | ||
| </Target> | ||
| <Target Name="DelphiLintClientTest250:Clean"> | ||
| <MSBuild Projects="test\DelphiLintClientTest250.dproj" Targets="Clean"/> | ||
| </Target> | ||
| <Target Name="DelphiLintClientTest250:Make"> | ||
| <MSBuild Projects="test\DelphiLintClientTest250.dproj" Targets="Make"/> | ||
| </Target> | ||
| <Target Name="Build"> | ||
| <CallTarget Targets="DelphiLintClient250;DelphiLintClientTest250"/> | ||
| </Target> | ||
| <Target Name="Clean"> | ||
| <CallTarget Targets="DelphiLintClient250:Clean;DelphiLintClientTest250:Clean"/> | ||
| </Target> | ||
| <Target Name="Make"> | ||
| <CallTarget Targets="DelphiLintClient250:Make;DelphiLintClientTest250:Make"/> | ||
| </Target> | ||
| <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,9 +319,9 @@ destructor TEditorHandler.Destroy; | |
| // Although these hooks are owned by the context menu, we need to free them when the plugin is disabled | ||
| for Hook in FPopupHooks.Values do begin | ||
| Hook.OnFreed.RemoveListener(OnHookFreed); | ||
| FreeAndNil(Hook); | ||
| Hook.Free; | ||
| end; | ||
| FreeAndNil(FPopupHooks); | ||
| FreeAndNil(FPopupHooks); // Remover? | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this comment mean? |
||
|
|
||
| if ContextValid then begin | ||
| Analyzer.OnAnalysisStateChanged.RemoveListener(OnAnalysisStateChanged); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,6 +354,59 @@ function TRuleHtmlGenerator.GenerateRuleDescriptionHtml(Description: TRuleDescri | |
| //______________________________________________________________________________________________________________________ | ||
|
|
||
| function TRuleHtmlGenerator.BuildHtmlPage(BodyHtml: string; BodyClass: string): string; | ||
|
|
||
| function GetLegacyScript: string; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webpack/Babel can polyfill for old IE versions (see |
||
| begin | ||
| Result := | ||
| 'function hasClass(element, className) {' + | ||
| ' return element.className && element.className.indexOf(className) !== -1;' + | ||
| '}' + | ||
| 'function addClass(element, className) {' + | ||
| ' if (!hasClass(element, className)) { element.className += " " + className }' + | ||
| '}' + | ||
| 'function removeClass(element, className) {' + | ||
| ' if (!hasClass(element, className)) { return }' + | ||
| ' element.className = element.className.replace(" " + className, "").replace(className, "");' + | ||
| '}' + | ||
| 'function getElementsWithClass(className) {' + | ||
| ' var elements = [];' + | ||
| ' var allElements = document.getElementsByTagName("*");' + | ||
| ' for (var i = 0; i < allElements.length; i++) {' + | ||
| ' if (hasClass(allElements[i], className)) { elements.push(allElements[i]) }' + | ||
| ' }' + | ||
| ' return elements;' + | ||
| '}' + | ||
| 'function highlightTag(tagName) {' + | ||
| ' var preElements = document.getElementsByTagName(tagName);' + | ||
| ' for (var i = 0; i < preElements.length; i++) {' + | ||
| ' var pre = preElements[i];' + | ||
| ' if (pre.getAttribute("data-diff-type")) {' + | ||
| ' addClass(pre, "hljs");' + | ||
| ' }' + | ||
| ' }' + | ||
| '};' + | ||
| 'function registerTabs() {' + | ||
| ' var tabBtns = getElementsWithClass("tab-btn");' + | ||
| ' for (var i = 0; i < tabBtns.length; i++) {' + | ||
| ' tabBtns[i].onclick = function () {' + | ||
| ' var activeButtons = getElementsWithClass("tab-btn active");' + | ||
| ' var activeContents = getElementsWithClass("tab-content active");' + | ||
| ' for (var j = 0; j < activeButtons.length ; j++) { removeClass(activeButtons[j], "active") }' + | ||
| ' for (var k = 0; k < activeContents.length; k++) { removeClass(activeContents[k], "active") }' + | ||
| ' addClass(this, "active");' + | ||
| ' var targetId = this.getAttribute("data-content-id");' + | ||
| ' var targetContent = document.getElementById(targetId);' + | ||
| ' if (targetContent) { addClass(targetContent, "active") }' + | ||
| ' };' + | ||
| ' }' + | ||
| '};' + | ||
| 'function initLegacy() {' + | ||
| ' highlightTag("pre");' + | ||
| ' registerTabs();' + | ||
| '};' + | ||
| 'setTimeout(initLegacy, 100);'; | ||
| end; | ||
|
|
||
| begin | ||
| Result := Format( | ||
| '<!DOCTYPE html>' + | ||
|
|
@@ -364,7 +417,15 @@ function TRuleHtmlGenerator.BuildHtmlPage(BodyHtml: string; BodyClass: string): | |
| '</head>' + | ||
| '<body class="%s">' + | ||
| ' <div class="content">%s</div>' + | ||
| ' <script src="script.js"></script>' + | ||
| ' <script>' + | ||
| ' if (Object.defineProperty) {' + | ||
| ' var script = document.createElement(''script'');' + | ||
| ' script.src = ''script.js'';' + | ||
| ' document.body.appendChild(script);' + | ||
| ' } else {' + | ||
| GetLegacyScript + | ||
| ' }' + | ||
| ' </script>' + | ||
| '</body>' + | ||
| '</html>', | ||
| [GenerateCss, BodyClass, BodyHtml]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,7 +188,7 @@ procedure TLintOptionsForm.RefreshTheme; | |
| WindowColor: TColor; | ||
| begin | ||
| LintContext.IDEServices.ApplyTheme(Self); | ||
| WindowColor := StyleServices(Self).GetSystemColor(clWindow); | ||
| WindowColor := StyleServices.GetSystemColor(clWindow); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this trailing whitespace. |
||
| ContentPanel.Color := WindowColor; | ||
| end; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,6 +222,11 @@ TLintServerThread = class(TThread) | |
| procedure RefreshServer; | ||
| procedure ReleaseServer; | ||
| end; | ||
| //______________________________________________________________________________________________________________________ | ||
|
|
||
| {$IF CompilerVersion < 33.0} | ||
| function EscapedString(AValue: string): string; | ||
| {$ENDIF} | ||
|
|
||
| //______________________________________________________________________________________________________________________ | ||
|
|
||
|
|
@@ -514,7 +519,7 @@ procedure TLintServer.OnAnalyzeResponse( | |
| begin | ||
| Result := TObjectList<TLintIssue>.Create; | ||
| for Index := 0 to Json.Count - 1 do begin | ||
| Result.Add(TLintIssue.CreateFromJson(Json[Index] as TJSONObject)); | ||
| Result.Add(TLintIssue.CreateFromJson(Json.Items[Index] as TJSONObject)); | ||
| end; | ||
| end; | ||
|
|
||
|
|
@@ -524,7 +529,7 @@ procedure TLintServer.OnAnalyzeResponse( | |
| begin | ||
| SetLength(Result, Json.Count); | ||
| for Index := 0 to Json.Count - 1 do begin | ||
| Result[Index] := Json[Index].Value; | ||
| Result[Index] := Json.Items[Index].Value; | ||
| end; | ||
| end; | ||
|
|
||
|
|
@@ -607,7 +612,7 @@ procedure TLintServer.OnRuleRetrieveResponse( | |
| Rules: TObjectDictionary<string, TRule>; | ||
| begin | ||
| if Response.Category <> CRuleRetrieveResult then begin | ||
| ErrorMsg := Response.Data.AsType<string>; | ||
| ErrorMsg := (Response.Data as TJSONString).Value; | ||
| ErrorCat := Response.Category; | ||
|
|
||
| Log.Warn('Rule retrieve returned error (%d): %s', [ErrorCat, ErrorMsg]); | ||
|
|
@@ -1009,7 +1014,7 @@ function TLintServerTcpConnection.DoReceiveMessage: TTaggedMessage; | |
|
|
||
| DataBuffer := TBytes(IdDataBuffer); | ||
|
|
||
| DataJsonValue := TJSONValue.ParseJSONValue(DataBuffer, 0, Length, True); | ||
| DataJsonValue := TJSONObject.ParseJSONValue(DataBuffer, 0, Length, True); | ||
| Result := TTaggedMessage.Create(TLintMessage.Create(Category, DataJsonValue), Id); | ||
| end; | ||
|
|
||
|
|
@@ -1027,7 +1032,11 @@ procedure TLintServerTcpConnection.DoSendMessage(Msg: TTaggedMessage); | |
| Message := Msg.Extract; | ||
|
|
||
| if Assigned(Message.Data) then begin | ||
| {$IF CompilerVersion < 33.0} | ||
| DataBytes := TEncoding.UTF8.GetBytes(EscapedString(Message.Data.ToString)); | ||
| {$ELSE} | ||
| DataBytes := TEncoding.UTF8.GetBytes(Message.Data.ToString); | ||
| {$ENDIF} | ||
|
Comment on lines
+1035
to
+1039
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reasoning behind this change? |
||
|
|
||
| FTcpClient.IOHandler.Write(Length(DataBytes)); | ||
| for DataByte in DataBytes do begin | ||
|
|
@@ -1123,4 +1132,25 @@ function TTaggedMessage.Extract: TLintMessage; | |
| FMessage := nil; | ||
| end; | ||
|
|
||
| //______________________________________________________________________________________________________________________ | ||
|
|
||
| {$IF CompilerVersion < 33.0} | ||
| function EscapedString(AValue: string): string; | ||
| begin | ||
| if AValue.StartsWith('"') then | ||
| AValue := AValue.Substring(1, AValue.Length-2); | ||
|
|
||
| // Tratar estes caracteres especiais: \, ", #$8, #$9, #$a, #$c, #$d | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please translate this comment into English. |
||
| Result := AValue | ||
| .Replace('\', '\\') | ||
| .Replace(#$8, '\b') | ||
| .Replace(#$9, '\t') | ||
| .Replace(#$a, '\n') | ||
| .Replace(#$c, '\f') | ||
| .Replace(#$d, '\r'); | ||
|
|
||
| Log.Info('ToString: ' + Result); | ||
| end; | ||
| {$ENDIF} | ||
|
|
||
| end. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,16 +215,16 @@ procedure TLintSettings.SyncTokenMap; | |
| begin | ||
| FTokensMap.Clear; | ||
|
|
||
| HostTokenPairs := SplitString(SonarHostTokens, ','); | ||
| HostTokenPairs := TArray<string>(SplitString(SonarHostTokens, ',')); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of these changes? |
||
| for Pair in HostTokenPairs do begin | ||
| SplitPair := SplitString(Pair, '='); | ||
| SplitPair := TArray<string>(SplitString(Pair, '=')); | ||
|
|
||
| if Length(SplitPair) <> 2 then begin | ||
| Log.Warn('Skipping invalid value ''%s'' in Sonar token mapping', [Pair]); | ||
| Continue; | ||
| end; | ||
|
|
||
| SplitIdent := SplitString(SplitPair[0], '@'); | ||
| SplitIdent := TArray<string>(SplitString(SplitPair[0], '@')); | ||
|
|
||
| if Length(SplitPair) <> 2 then begin | ||
| Log.Warn('Skipping invalid value for key ''%s'' in Sonar token mapping', [SplitPair[0]]); | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these changes accidental? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of these changes?