microsoft / microsoft/TypeScript-TmLanguage
Unexpected coloring of the token in the editor
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 471
- Fork
- 149
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
While examining code in the diff editor, I noticed that the color schema appears to be off. Notice how in the following image, the this token on line 322 is colored green while it should actually be a dark blue (like the other this tokens).
I was using the following code:
Code
private _renderFoldingIconForLine(container: HTMLSpanElement, foldingModel: FoldingModel | null | undefined, index: number, line: number): FoldingIcon | undefined {
const showFoldingControls: 'mouseover' | 'always' | 'never' =
this._editor.getOption(EditorOption.showFoldingControls);
if (!foldingModel || showFoldingControls === 'never') {
return;
}
const foldingRegions = foldingModel.regions;
const indexOfFoldingRegion = foldingRegions.findRange(line);
const startLineNumber = foldingRegions.getStartLineNumber(indexOfFoldingRegion);
const isFoldingScope = line === startLineNumber;
if (!isFoldingScope) {
return;
}
const foldingIconNode = container.appendChild(document.createElement('div'));
const isCollapsed = foldingRegions.isCollapsed(indexOfFoldingRegion);
foldingIconNode.className = ThemeIcon.asClassName(isCollapsed ? foldingCollapsedIcon : foldingExpandedIcon);
const foldingIcon = new FoldingIcon(foldingIconNode, isCollapsed);
foldingIcon.setVisible(isCollapsed || showFoldingControls === 'always');
foldingIcon.setTransitionRequired(true);
this._foldingIconStore.add(dom.addDisposableListener(foldingIconNode, dom.EventType.CLICK, () => {
toggleCollapseState(foldingModel, Number.MAX_VALUE, [line]);
foldingIcon.isCollapsed = !isCollapsed;
const scrollTop = (
isCollapsed ?
this._editor.getTopForLineNumber(startLineNumber)
: this._editor.getTopForLineNumber(foldingRegions.getEndLineNumber(indexOfFoldingRegion)))
- this._lineHeight * index + 1;
this._editor.setScrollTop(scrollTop);
}));
return foldingIcon;
}
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện màu sắc trong trình chỉnh sửa khác biệt của VS Code bằng đoạn mã TypeScript và ảnh chụp màn hình được cung cấp, sau đó kiểm tra ngữ pháp TextMate của TypeScript và các phạm vi token cho token this bị ảnh hưởng. Issue hoàn tất khi token đó nhận được cùng màu xanh lam đậm như các token this khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100