View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038498 | Lazarus | IDE | public | 2021-02-16 19:01 | 2021-03-07 20:07 |
Reporter | Akira1364 | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | x86_64 | OS | Windows | ||
Product Version | 2.0.10 | ||||
Summary | 0038498: "Enable preprocessor parsing" should be enabled by default in JCF, as perfectly valid code is often unformattable without it | ||||
Description | Particularly for someone who might be a newcomer to Lazarus, I don't think it would be even slightly obvious that "Enable preprocessor parsing" not being checked is the actual reason the formatter is failing on their code. At the surface level it moreso just tends to appear that the formatter is simply not "good enough" to handle defines properly in that scenario, even though that is not the case. I'm not sure why "Enable preprocessor parsing" even exists, frankly... I can't see what the advantage of ever having it disabled would be. | ||||
Steps To Reproduce | None specifically needed. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r64636 | ||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
Support+. |
|
I Agree that is better to use the preprocessor parser. JCF stores the default options in jcfsettings.res so this patch modifies this file changing <PreProcessor> <Enabled> False </Enabled> to <PreProcessor> <Enabled> True </Enabled> and adds the files needed ( jcfsettings.rc, Default_JCFSETTINGS.cfg) to build it with windres or another resource compiler. NOTE: it may be necessary to delete the files in the lib folder and subfolders to force the recompilation and linking of the latest version of the "jcfsettings.res" file. Or force a full recompilation of the IDE. JCF_ChangeDefaultOptions.patch (13,992 bytes)
From 263d38732c178bf34a1ee6105f52aed7d82b5b0b Mon Sep 17 00:00:00 2001 From: DomingoGP <dgalmesp@gmail.com> Date: Thu, 18 Feb 2021 21:05:51 +0100 Subject: [PATCH] Change default options of JCF. enable preprocessor parsing. --- .../IdePlugin/lazarus/Default_JCFSETTINGS.cfg | 184 ++++++++++++++++++ .../lazarus/README_DefaultConfiguration.txt | 10 + .../jcf2/IdePlugin/lazarus/jcfsettings.rc | 3 + .../jcf2/IdePlugin/lazarus/jcfsettings.res | Bin 11563 -> 11564 bytes 4 files changed, 197 insertions(+) create mode 100644 components/jcf2/IdePlugin/lazarus/Default_JCFSETTINGS.cfg create mode 100644 components/jcf2/IdePlugin/lazarus/README_DefaultConfiguration.txt create mode 100644 components/jcf2/IdePlugin/lazarus/jcfsettings.rc diff --git a/components/jcf2/IdePlugin/lazarus/Default_JCFSETTINGS.cfg b/components/jcf2/IdePlugin/lazarus/Default_JCFSETTINGS.cfg new file mode 100644 index 0000000000..6a3dc055f1 --- /dev/null +++ b/components/jcf2/IdePlugin/lazarus/Default_JCFSETTINGS.cfg @@ -0,0 +1,184 @@ +<?xml version="1.0" ?> +<JediCodeFormatSettings> + <WriteVersion> 2.44 </WriteVersion> + <WriteDateTime> 40208.0415705324 </WriteDateTime> + <Description> format settings for use with Lazarus </Description> + <Obfuscate> + <Enabled> False </Enabled> + <Caps> 1 </Caps> + <RemoveComments> True </RemoveComments> + <RemoveWhiteSpace> True </RemoveWhiteSpace> + <RemoveIndent> True </RemoveIndent> + <RebreakLines> True </RebreakLines> + </Obfuscate> + <Clarify> + <OnceOffs> 0 </OnceOffs> + <Warnings> True </Warnings> + <WarnUnusedParams> False </WarnUnusedParams> + <IgnoreUnusedParams> Sender </IgnoreUnusedParams> + <FileExtensions> dpr,lpr,pas,pp </FileExtensions> + </Clarify> + <Indent> + <IndentationSpaces> 2 </IndentationSpaces> + <FirstLevelIndent> 0 </FirstLevelIndent> + <HasFirstLevelIndent> False </HasFirstLevelIndent> + <IndentBeginEnd> False </IndentBeginEnd> + <IndentbeginEndSpaces> 2 </IndentbeginEndSpaces> + <IndentLibraryProcs> True </IndentLibraryProcs> + <IndentProcedureBody> False </IndentProcedureBody> + <KeepCommentsWithCodeInGlobals> True </KeepCommentsWithCodeInGlobals> + <KeepCommentsWithCodeInProcs> True </KeepCommentsWithCodeInProcs> + <KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef> + <KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere> + <IndentElse> False </IndentElse> + <IndentCaseElse> True </IndentCaseElse> + <IndentNestedTypes> False </IndentNestedTypes> + <IndentVarAndConstInClass> False </IndentVarAndConstInClass> + </Indent> + <Spaces> + <TabsToSpaces> True </TabsToSpaces> + <SpacesToTabs> False </SpacesToTabs> + <SpacesPerTab> 2 </SpacesPerTab> + <SpacesForTab> 2 </SpacesForTab> + <FixSpacing> True </FixSpacing> + <SpaceBeforeClassHeritage> False </SpaceBeforeClassHeritage> + <SpacesBeforeColonVar> 0 </SpacesBeforeColonVar> + <SpacesBeforeColonConst> 0 </SpacesBeforeColonConst> + <SpacesBeforeColonParam> 0 </SpacesBeforeColonParam> + <SpacesBeforeColonFn> 0 </SpacesBeforeColonFn> + <SpacesBeforeColonClassVar> 0 </SpacesBeforeColonClassVar> + <SpacesBeforeColonRecordField> 0 </SpacesBeforeColonRecordField> + <SpacesBeforeColonCaseLabel> 0 </SpacesBeforeColonCaseLabel> + <SpacesBeforeColonLabel> 0 </SpacesBeforeColonLabel> + <SpacesBeforeColonInGeneric> 0 </SpacesBeforeColonInGeneric> + <MaxSpacesInCode> 2 </MaxSpacesInCode> + <UseMaxSpacesInCode> True </UseMaxSpacesInCode> + <SpaceForOperator> 0 </SpaceForOperator> + <SpaceBeforeOpenBracketsInFunctionDeclaration> False </SpaceBeforeOpenBracketsInFunctionDeclaration> + <SpaceBeforeOpenBracketsInFunctionCall> False </SpaceBeforeOpenBracketsInFunctionCall> + <SpaceBeforeOpenSquareBracketsInExpression> False </SpaceBeforeOpenSquareBracketsInExpression> + <SpaceAfterOpenBrackets> False </SpaceAfterOpenBrackets> + <SpaceBeforeCloseBrackets> False </SpaceBeforeCloseBrackets> + <MoveSpaceToBeforeColon> False </MoveSpaceToBeforeColon> + </Spaces> + <Returns> + <WhenRebreakLines> 2 </WhenRebreakLines> + <MaxLineLength> 90 </MaxLineLength> + <NumReturnsAfterFinalEnd> 1 </NumReturnsAfterFinalEnd> + <RemoveBadReturns> True </RemoveBadReturns> + <AddGoodReturns> True </AddGoodReturns> + <UsesOnePerLine> False </UsesOnePerLine> + <BreakAfterUses> False </BreakAfterUses> + <RemoveExpressionReturns> True </RemoveExpressionReturns> + <RemoveVarReturns> True </RemoveVarReturns> + <NoReturnsInProperty> True </NoReturnsInProperty> + <RemoveProcedureDefReturns> True </RemoveProcedureDefReturns> + <RemoveReturns> True </RemoveReturns> + <RemoveVarBlankLines> True </RemoveVarBlankLines> + <RemoveProcHeaderBlankLines> True </RemoveProcHeaderBlankLines> + <Block> 1 </Block> + <BlockBegin> 0 </BlockBegin> + <Label> 1 </Label> + <LabelBegin> 1 </LabelBegin> + <CaseLabel> 1 </CaseLabel> + <CaseBegin> 1 </CaseBegin> + <CaseElse> 0 </CaseElse> + <CaseElseBegin> 0 </CaseElseBegin> + <EndElse> 0 </EndElse> + <ElseIf> 1 </ElseIf> + <ElseBegin> 0 </ElseBegin> + <BeforeCompilerDirectUses> 1 </BeforeCompilerDirectUses> + <BeforeCompilerDirectStatements> 0 </BeforeCompilerDirectStatements> + <BeforeCompilerDirectGeneral> 1 </BeforeCompilerDirectGeneral> + <AfterCompilerDirectUses> 1 </AfterCompilerDirectUses> + <AfterCompilerDirectStatements> 0 </AfterCompilerDirectStatements> + <AfterCompilerDirectGeneral> 1 </AfterCompilerDirectGeneral> + <ReturnChars> 0 </ReturnChars> + <RemoveConsecutiveBlankLines> True </RemoveConsecutiveBlankLines> + <MaxConsecutiveBlankLines> 4 </MaxConsecutiveBlankLines> + <MaxBlankLinesInSection> 1 </MaxBlankLinesInSection> + <LinesBeforeProcedure> 1 </LinesBeforeProcedure> + </Returns> + <Comments> + <RemoveEmptyDoubleSlashComments> True </RemoveEmptyDoubleSlashComments> + <RemoveEmptyCurlyBraceComments> True </RemoveEmptyCurlyBraceComments> + </Comments> + <Capitalisation> + <Enabled> True </Enabled> + <ReservedWords> 1 </ReservedWords> + <Operators> 1 </Operators> + <Directives> 1 </Directives> + <Constants> 1 </Constants> + <Types> 1 </Types> + </Capitalisation> + <SpecificWordCaps> + <Enabled> True </Enabled> + <Words> </Words> + </SpecificWordCaps> + <Identifiers> + <Enabled> True </Enabled> + <Words> ActivePage,AnsiCompareStr,AnsiCompareText,AnsiUpperCase,AsBoolean,AsDateTime,AsFloat,AsInteger,Assign,AsString,AsVariant,BeginDrag,Buttons,Caption,Checked,Classes,ClassName,Clear,Close,Components,Controls,Count,Create,Data,Dec,Delete,Destroy,Dialogs,Enabled,EndDrag,EOF,Exception,Execute,False,FieldByName,First,Forms,Free,FreeAndNil,GetFirstChild,Graphics,Height,idAbort,idCancel,idIgnore,IDispatch,idNo,idOk,idRetry,idYes,Inc,Initialize,IntToStr,ItemIndex,IUnknown,Lines,Math,MaxValue,mbAbort,mbAll,mbCancel,mbHelp,mbIgnore,mbNo,mbOK,mbRetry,mbYes,mbYesToAll,Messages,MinValue,mnNoToAll,mrAbort,mrAll,mrCancel,mrIgnore,mrNo,mrNone,mrNoToAll,mrOk,mrRetry,mrYes,mrYesToAll,mtConfirmation,mtCustom,mtError,mtInformation,mtWarning,Name,Next,Open,Ord,ParamStr,PChar,Perform,ProcessMessages,Read,ReadOnly,RecordCount,Register,Release,Result,Sender,SetFocus,Show,ShowMessage,Source,StdCtrls,StrToInt,SysUtils,TAutoObject,TButton,TComponent,TDataModule,Text,TForm,TFrame,TList,TNotifyEvent,TObject,TObjectList,TPageControl,TPersistent,True,TStringList,TStrings,TTabSheet,Unassigned,Value,Visible,WideString,Width,Windows,Write </Words> + </Identifiers> + <NotIdent> + <Enabled> True </Enabled> + <Words> False,Name,nil,PChar,read,ReadOnly,True,WideString,write </Words> + </NotIdent> + <UnitNameCaps> + <Enabled> True </Enabled> + <Words> ActnColorMaps,ActnCtrls,ActnList,ActnMan,ActnMenus,ActnPopup,ActnRes,ADOConst,ADODB,ADOInt,AppEvnts,AxCtrls,BandActn,bdeconst,bdemts,Buttons,CheckLst,Classes,Clipbrd.pas,CmAdmCtl,ComCtrls,ComStrs,Consts,Controls,CtlConsts,CtlPanel,CustomizeDlg,DataBkr,DB,DBActns,dbcgrids,DBClient,DBClientActnRes,DBClientActns,DBCommon,DBConnAdmin,DBConsts,DBCtrls,DbExcept,DBGrids,DBLocal,DBLocalI,DBLogDlg,dblookup,DBOleCtl,DBPWDlg,DBTables,DBXpress,DdeMan,Dialogs,DrTable,DSIntf,ExtActns,ExtCtrls,ExtDlgs,FileCtrl,FMTBcd,Forms,Graphics,GraphUtil,Grids,HTTPIntr,IB,IBBlob,IBCustomDataSet,IBDatabase,IBDatabaseInfo,IBDCLConst,IBErrorCodes,IBEvents,IBExternals,IBExtract,IBGeneratorEditor,IBHeader,IBIntf,IBQuery,IBRestoreEditor,IBSecurityEditor,IBServiceEditor,IBSQL,IBSQLMonitor,IBStoredProc,IBTable,IBUpdateSQL,IBUtils,IBXConst,ImgList,Jcl8087,JclAbstractContainers,JclAlgorithms,JclAnsiStrings,JclAppInst,JclArrayLists,JclArraySets,JclBase,JclBinaryTrees,JclBorlandTools,JclCIL,JclCLR,JclCOM,JclComplex,JclCompression,JclConsole,JclContainerIntf,JclCounter,JclDateTime,JclDebug,JclDotNet,JclEDI,JclEDI_ANSIX12,JclEDI_ANSIX12_Ext,JclEDI_UNEDIFACT,JclEDI_UNEDIFACT_Ext,JclEDISEF,JclEDITranslators,JclEDIXML,JclExprEval,JclFileUtils,JclFont,JclGraphics,JclGraphUtils,JclHashMaps,JclHashSets,JclHookExcept,JclIniFiles,JclLANMan,JclLinkedLists,JclLocales,JclLogic,JclMapi,JclMath,JclMetadata,JclMIDI,JclMime,JclMiscel,JclMsdosSys,JclMultimedia,JclNTFS,JclPCRE,JclPeImage,JclPrint,JclQGraphics,JclQGraphUtils,JclQueues,JclRegistry,JclResources,JclRTTI,JclSchedule,JclSecurity,JclShell,JclSimpleXml,JclStacks,JclStatistics,JclStreams,JclStrHashMap,JclStringLists,JclStrings,JclStructStorage,JclSvcCtrl,JclSynch,JclSysInfo,JclSysUtils,JclTask,JclTD32,JclUnicode,JclUnitConv,JclUnitVersioning,JclUnitVersioningProviders,JclValidation,JclVectors,JclWideFormat,JclWideStrings,JclWin32,JclWin32Ex,JclWinMIDI,ListActns,Mask,MConnect,Menus,Midas,MidasCon,MidConst,MPlayer,MtsRdm,Mxconsts,ObjBrkr,OleAuto,OleConst,OleCtnrs,OleCtrls,OleDB,OleServer,Outline,Printers,Provider,recerror,ScktCnst,ScktComp,ScktMain,SConnect,ShadowWnd,SimpleDS,SMINTF,SqlConst,SqlExpr,SqlTimSt,StdActnMenus,StdActns,StdCtrls,StdStyleActnCtrls,SvcMgr,SysUtils,TabNotBk,Tabs,TConnect,Themes,ToolWin,ValEdit,VDBConsts,WinHelpViewer,XPActnCtrls,XPMan,XPStyleActnCtrls </Words> + </UnitNameCaps> + <Asm> + <Caps> 0 </Caps> + <BreaksAfterLabel> 1 </BreaksAfterLabel> + <BreaksAfterLabelEnabled> True </BreaksAfterLabelEnabled> + <StatementIndentEnabled> True </StatementIndentEnabled> + <StatementIndent> 7 </StatementIndent> + <ParamsIndentEnabled> True </ParamsIndentEnabled> + <ParamsIndent> 15 </ParamsIndent> + </Asm> + <PreProcessor> + <Enabled> True </Enabled> + <DefinedSymbols> MSWINDOWS </DefinedSymbols> + <DefinedOptions> </DefinedOptions> + </PreProcessor> + <Align> + <AlignAssign> False </AlignAssign> + <AlignConst> False </AlignConst> + <AlignTypedef> False </AlignTypedef> + <AlignVars> False </AlignVars> + <AlignComment> False </AlignComment> + <AlignFields> False </AlignFields> + <InterfaceOnly> False </InterfaceOnly> + <MinColumn> 2 </MinColumn> + <MaxColumn> 60 </MaxColumn> + <MaxVariance> 5 </MaxVariance> + <MaxVarianceInterface> 5 </MaxVarianceInterface> + <MaxUnalignedStatements> 0 </MaxUnalignedStatements> + </Align> + <Replace> + <Enabled> False </Enabled> + <Words> </Words> + </Replace> + <Uses> + <RemoveEnabled> False </RemoveEnabled> + <InsertInterfaceEnabled> False </InsertInterfaceEnabled> + <InsertImplementationEnabled> False </InsertImplementationEnabled> + <FindReplaceEnabled> False </FindReplaceEnabled> + <Remove> </Remove> + <InsertInterface> </InsertInterface> + <InsertImplementation> </InsertImplementation> + <Find> </Find> + <Replace> </Replace> + </Uses> + <Transform> + <BeginEndStyle> 1 </BeginEndStyle> + <AddBlockEndSemicolon> True </AddBlockEndSemicolon> + <SortUsesInterface> False </SortUsesInterface> + <SortUsesImplmentation> False </SortUsesImplmentation> + <SortUsesProgram> False </SortUsesProgram> + <SortUsesBreakOnReturn> False </SortUsesBreakOnReturn> + <SortUsesBreakOnComment> False </SortUsesBreakOnComment> + <SortUsesSortOrder> 0 </SortUsesSortOrder> + <SortUsesNoComments> False </SortUsesNoComments> + </Transform> +</JediCodeFormatSettings> diff --git a/components/jcf2/IdePlugin/lazarus/README_DefaultConfiguration.txt b/components/jcf2/IdePlugin/lazarus/README_DefaultConfiguration.txt new file mode 100644 index 0000000000..abbd69b29c --- /dev/null +++ b/components/jcf2/IdePlugin/lazarus/README_DefaultConfiguration.txt @@ -0,0 +1,10 @@ +The default configuration of JCF is stored in the resource file +jcfsettings.res, so for changing we need to modify that file with +a resource editor or rebuild with + +windres -i jcfsettings.rc -o jcfsettings.res + +and force a recompilation deleting the files in folder lib and subfolders of lib. + + + diff --git a/components/jcf2/IdePlugin/lazarus/jcfsettings.rc b/components/jcf2/IdePlugin/lazarus/jcfsettings.rc new file mode 100644 index 0000000000..33a931bdd5 --- /dev/null +++ b/components/jcf2/IdePlugin/lazarus/jcfsettings.rc @@ -0,0 +1,3 @@ +LANGUAGE 0,0 +JCFSETTINGS RCDATA "Default_JCFSETTINGS.cfg" + diff --git a/components/jcf2/IdePlugin/lazarus/jcfsettings.res b/components/jcf2/IdePlugin/lazarus/jcfsettings.res index 82325fb2dc723eec14dc7dd9ab28a61f58fa87ff..29822de2181b56f46557624f96035defc5b9b198 100644 GIT binary patch delta 29 lcmZ1-wI*tU0^_xbit3C88$DUoChLhwY))4@!p6kF005dJ2)zIR delta 26 icmZ1zwK{5o0^{|Git3C48$DUoCi^f-ZcbA>!Uh0-pa`V^ -- 2.30.0.windows.1 |
|
Why such a big patch? I could imagine that one simple setting somewhere could solve it. |
|
I thought so too, but when registering JCF it checks if the file jcfsettings.cfg exists and if it does not exist (when installing lazarus it does not exist) it rewrites it with the content of jcfsettins.res making the changes of the options by code useless. Look at the SetLazarusDefaultFileName procedure in jcfideregister.pas called by the Register procedure. The patch is big because I have added the jcfsettins.rc file and the Default_JCFSETTINGS.cfg which are not necessary, but are useful if changes need to be made in the future. You only need to apply the changes to jcfsetting.res. |
|
Ok, I applied the patch. Please test. |
|
Tested and working as expected. Thanks for apply. |
|
Thanks Domingo / Juha. |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-16 19:01 | Akira1364 | New Issue | |
2021-02-17 11:26 | CudaText man | Note Added: 0128965 | |
2021-02-18 22:22 | Domingo Galmés | Note Added: 0129005 | |
2021-02-18 22:22 | Domingo Galmés | File Added: JCF_ChangeDefaultOptions.patch | |
2021-02-20 11:20 | Juha Manninen | Note Added: 0129033 | |
2021-02-20 21:02 | Domingo Galmés | Note Added: 0129039 | |
2021-02-21 09:33 | Juha Manninen | Assigned To | => Juha Manninen |
2021-02-21 09:33 | Juha Manninen | Status | new => assigned |
2021-02-21 09:35 | Juha Manninen | Status | assigned => resolved |
2021-02-21 09:35 | Juha Manninen | Resolution | open => fixed |
2021-02-21 09:35 | Juha Manninen | Fixed in Revision | => r64636 |
2021-02-21 09:35 | Juha Manninen | LazTarget | => - |
2021-02-21 09:35 | Juha Manninen | Widgetset | Win32/Win64 => Win32/Win64 |
2021-02-21 09:35 | Juha Manninen | Note Added: 0129048 | |
2021-02-21 14:19 | Domingo Galmés | Note Added: 0129059 | |
2021-03-07 20:07 | Akira1364 | Note Added: 0129496 |