Visual Basic 6에서 대 / 소문자 변경 중지
적절한 대답을 찾기가 불가능한 매우 간단한 질문 : Visual Basic 6에서 ^ @ # * ing 변수 대 / 소문자 변경을 중지하려면 어떻게해야합니까!?!
많은 VB 사용자의 일반적인 의견은이 "기능"이 실제로 상당히 도움이된다는 것입니다.하지만 어떤 소스 제어 시스템에서도 많이 사용하는지 의심 스럽습니다. 다른 여러 개발자와 상당한 규모의 프로젝트에서 공동 작업을 시도 할 때 이것은 절대적으로 영향을 미칩니다. 무시하면 파일에 수천 개의 오 탐지 "변경"을 생성하여 (실제 코드 변경이없는 경우에도!) 수정 내역을 오염시키고 경우에 따라 실제 변경 사항을 찾는 것이 거의 불가능하게 만듭니다.
무시하지 않으면 (예 : "불필요한 대소 문자 변경 없음"정책을 구현해야하는 제 사무실처럼) VB의 "수정 사항을 신중하게 되돌려 야하기 때문에 각 커밋에 일반적으로 사용하는 시간의 5 배를 소비합니다. "모든 파일에서, 때로는 수백 줄을 되돌려 한 줄만 변경합니다.
확실히이 원하지 않는 "기능"을 제거 할 수있는 설정, 플러그인, 해킹 등이 있어야합니까? 팬텀 diff 더미를 골라 낼 필요가없는 한 내가 얻을 수있는 모든 방법을 기꺼이 취할 것입니다. 그리고 몇 가지 불만 사항을 사전에 없애기 위해 : 아니요, diff 도구에서 케이스 감지를 끌 수 없습니다. 그게 요점이 아닙니다. 아니요, 전 세계적으로 케이스를 변경할 수는 없습니다. 우리는 수년간의 개발에 걸쳐 여러 개발자가 작업하는 수십만 개의 LOC와 함께 작업하고 있습니다. 비즈니스 관점에서 불가능한 동기화. 마지막으로 : 아니요, VB.net으로 업그레이드하거나 다른 언어로 이식 할 수 없습니다 (내가 원하는만큼).
(그리고 예, 저는 현재 약간 오줌 누고 있습니다. 말할 수 있습니까? 죄송합니다.하지만 이로 인해 시간과 회사 비용이 들기 때문에 허용되지 않습니다.)
다음은 실제 시나리오와 350k LOC VB6 프로젝트에서이를 해결 한 방법입니다.
우리는 Janus Grid를 사용하고 있으며 JSColumn의 DefaultValue 속성을 참조하는 모든 코드 행이 defaultValue로 변경되었습니다. 이것은 전체 IDE 성가신 문제를 디버깅 할 수있는 기회였습니다.
내가 찾은 것은 MSXML에 대한 참조가 방금 추가되었으며 이제 IDE가 Janus Grid typelib 전에 ISchemaAttributes의 defaultValue 속성을 선택한다는 것입니다.
몇 가지 실험 후 IDE가 다음 순서로 "등록 된"식별자를 수집한다는 것을 알았습니다.
나열된 순서대로 프로젝트-> 참조에서 참조 된 라이브러리 / 프로젝트
프로젝트-> 컴포넌트의 컨트롤 (알 수없는 순서)
소스 코드
그래서 우리가 한 간단한 수정은 적절한 대 / 소문자를 유지하는 메서드로 더미 클래스 / 인터페이스를 만드는 것이 었습니다. 우리는 이미 다른 typelib보다 먼저 모든 프로젝트에서 참조한 프로젝트 전체 typelib를 가지고 있었기 때문에 쉽게 할 수있었습니다.
다음은 IUcsVbIntellisenseFix 인터페이스에 대한 IDL의 일부입니다.
[
odl,
uuid(<<guid_here>>),
version(1.0),
dual,
nonextensible,
oleautomation
]
interface IUcsVbIntellisenseFix : IDispatch {
[id(1)] HRESULT DefaultValue();
[id(2)] HRESULT Selector();
[id(3)] HRESULT Standalone();
...
}
IUcsVbIntellisenseFix에 많은 메서드를 추가했으며, 그중 일부는 맞춤법 오류에 사용한 열거 형 항목과 수정하려는 항목의 이름을 따서 명명되었습니다. 모든 프로젝트에서 참조되는 공용 라이브러리 (ActiveX DLL)의 간단한 VB 클래스를 사용하여 동일한 작업을 수행 할 수 있습니다.
이렇게하면 IDE가 실제로 IUcsVbIntellisenseFix 케이스에 따라 케이스를 수정 했기 때문에 어느 시점에서 소스 코드가 적절한 케이스로 수렴되었습니다 . 이제 우리는 시도하더라도 열거 형, 메서드 또는 속성의 철자를 잘못 입력 할 수 없습니다.
상황에 따라 추가
#If False Then
Dim CorrectCase
#End If
도움이 될 수 있습니다.
간단한 방법 : Dim원하는 경우 각 변수. 그렇지 않으면 VBA이해할 수없는 방식으로 변경됩니다.
Dim x, X1, X2, y, Yy as variant
서브 루틴에서 모든 케이스를 Dim명령문의 케이스로 변경합니다 .
공감할 수 있습니다. 다행히 버전 제어 비교 도구에서 대소 문자 구분을 해제 할 수 있습니다!
VB6 IDE 자동 대 / 소문자 수정은 VBP 파일에 모듈이 나열되는 순서에 따라 변수 선언 및 참조에서 대소 문자를 변경하는 것 같습니다. 그러나 IDE는 파일을 저장해야한다고 알려주지 않습니다. 따라서 문제는 다른 편집으로 인해 파일을 저장할 때만 나타납니다. 프로젝트의 모든 파일을 확인하고 신중하게 케이스를 설정하여이를 방지하려고 잠시 시도했지만 사라지지 않았습니다.
I suppose you could list the variable names that are affected - the usual suspects are one letter names like "I", "X" and "Y", perhaps because they are used in standard event handlers like MouseDown. Then write an add-in that'll search for all declarations " As" and force the case to upper. Run the add-in on your modules before you check them in. You might be able to trigger the add-in to run automatically when you save in VB6.
EDIT: Something I've just thought of: adapt Fred's answer. From now on, every time you check in a file, add a block at the top to establish canonical case for the usual suspects. If nothing else, it's easier than reverting hundreds of lines by hand. Eventually you will have this block in every file & maybe then the problem will stop happening.
#If False Then
Dim I, X, Y ' etc '
#End If
I standardised the case across the codebase, normally by using the examples above (Dim CorrectCase), and removing it again. I then triggered VB to save EVERY file, by doing a case sensitive search/replace of "End" with "End" (no functional change, but enough to get VB to resave). Once that was done, I could then do a single commit to standardise the case, making it MUCH easier to keep on top of it at a later date.
Specifically for controlling the case of enum values, there is a VB6 IDE add-in which may be helpful. Enums seem to have a slightly unique version of this problem.
As described in the link below:
The VB6 IDE has an annoying quirk when it comes to the case of Enum members. Unlike with other identifiers, the IDE doesn't enforce the case of an Enum member as it was declared in the Enum block. That occasionally causes an Enum member that was manually written to lose its original case, unless a coder typed it carefully enough. ...
However, if a project contains a lot of Enums and/or a particular Enum has a lot of members, redeclaring the members in each of them can get quite tedious fast. ...
Ref: http://www.vbforums.com/showthread.php?778109-VB6-modLockEnumCase-bas-Enforce-Case-of-Enums
...load and unload the add-in as needed via the Add-In Manager dialog box. Usage is as simple as selecting the entire Enum block, right-clicking and then choosing the "Lock Enum Case" context menu item.
I don't think there's any to do it. The IDE will change the case of the variable name to whatever it is when it's declared. But, honestly, back in the day I worked on several large VB6 projects and never found this to be a problem. Why are people on your development team constantly changing variable declarations? It seems like you have not established a clear variable naming policy that you enforce. I know your upset, so no offense, but it might be your policies that are lacking in this regard.
Unfortunately, according to this SO thread, alternate VB6 IDEs are hard to come by. So, your best bet is to solve this problem via policy. Or move to VB.NET. :)
Wow. I've spent a lot of time programming in VB6 and I have no idea what you're on about. The only thing I can think you're referring to is that intellisense will change the capitalization of variable names to match their declarations. If you're complaining about that, I would have to wonder why the hell they've been entered any other way to begin with. And if that is your problem, no, there's no way to disable it that I'm aware of. I'd suggest you, in one go, check out every file, make sure the caps on the declarations and uses of variables all match and check back in.
참고URL : https://stackoverflow.com/questions/1064858/stop-visual-basic-6-from-changing-my-casing
'Program Club' 카테고리의 다른 글
| LaTeX를 ePub로 변환 (0) | 2020.12.05 |
|---|---|
| MySQL 데이터베이스에서 버전 제어 (Git) 사용 (0) | 2020.12.05 |
| C # WinForms 앱 트레이를 최소화하는 적절한 방법은 무엇입니까? (0) | 2020.12.05 |
| OutOfMemoryError : 비트 맵 크기가 VM 예산을 초과합니다 :-Android (0) | 2020.12.05 |
| App Engine 스케줄러는 언제 새 스레드와 새 인스턴스를 사용하나요? (0) | 2020.12.05 |