hunk
dict | file
stringlengths 0
11.8M
| file_path
stringlengths 2
234
| label
int64 0
1
| commit_url
stringlengths 74
103
| dependency_score
listlengths 5
5
|
---|---|---|---|---|---|
{
"id": 8,
"code_window": [
" transform: translateX(0);\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n"
],
"labels": [
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 55
} | import {Component, Directive, View, Injector, NgFor, ElementRef, Optional, Host, forwardRef, NgZone} from 'angular2/angular2';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {Ion} from '../ion';
import {IonicApp} from '../app/app';
import {NavController} from '../nav/nav-controller';
import {ViewController} from '../nav/view-controller';
import {IonicComponent, IonicView} from '../../config/decorators';
import {IonicConfig} from '../../config/config';
import * as dom from 'ionic/util/dom';
/**
* The Tabs component is a container with a [TabBar]() and any number of
* individual [Tab]() components. On iOS, the TabBar is placed on the bottom of
* the screen, while on Android it is at the top.
*
* For basic Tabs usage, see the [Tabs section](../../../../components/#tabs) of the component docs.
* See the [Tab API reference](../Tab/) for more details on individual Tab components.
*
* You can override the platform specific TabBar placement by using the
* `tab-bar-placement` property:
*
* ```ts
* <ion-tabs tab-bar-placement="top">
* <ion-tab [root]="tabRoot"></ion-tab>
* </ion-tabs>
* ```
*
* To change the location of the icons in the TabBar, use the `tab-bar-icons`
* property:
* ```ts
* <ion-tabs tab-bar-icons="bottom">
* <ion-tab [root]="tabRoot"></ion-tab>
* </ion-tabs>
* ```
*
* You can select tabs programatically by injecting Tabs into any child
* component, and using the [select()](#select) method:
* ```ts
* @IonicView({
* template: `<button (click)="goToTabTwo()">Go to Tab2</button>`
* })
* class TabOne {
* constructor(tabs: Tabs){
* this.tabs = tabs;
* }
*
* goToTabTwo() {
* this.tabs.select(this.tabs.tabs[1]);
* }
* }
* ```
* The [tabs](#tabs) property is an array of all child [Tab](../Tab/) components
* of this Tabs component.
*
*/
@IonicComponent({
selector: 'ion-tabs',
defaultProperties: {
'tabBarPlacement': 'bottom',
'tabBarIcons': 'top'
}
})
@IonicView({
template: '' +
'<section class="navbar-container">' +
'<template navbar-anchor></template>' +
'</section>' +
'<nav class="tab-bar-container">' +
'<tab-bar role="tablist">' +
'<a *ng-for="#t of tabs" [tab]="t" class="tab-button" role="tab">' +
'<icon [name]="t.tabIcon" [is-active]="t.isSelected" class="tab-button-icon"></icon>' +
'<span class="tab-button-text">{{t.tabTitle}}</span>' +
'</a>' +
'<tab-highlight></tab-highlight>' +
'</tab-bar>' +
'</nav>' +
'<section class="content-container">' +
'<ng-content></ng-content>' +
'</section>',
directives: [
forwardRef(() => TabButton),
forwardRef(() => TabHighlight),
forwardRef(() => TabNavBarAnchor)
]
})
export class Tabs extends NavController {
/**
* TODO
*/
constructor(
@Optional() hostNavCtrl: NavController,
@Optional() viewCtrl: ViewController,
app: IonicApp,
injector: Injector,
elementRef: ElementRef,
zone: NgZone
) {
super(hostNavCtrl, injector, elementRef, zone);
this.app = app;
this._ready = new Promise(res => { this._isReady = res; });
// Tabs may also be an actual ViewController which was navigated to
// if Tabs is static and not navigated to within a NavController
// then skip this and don't treat it as it's own ViewController
if (viewCtrl) {
this.viewCtrl = viewCtrl;
// special overrides for the Tabs ViewController
// the Tabs ViewController does not have it's own navbar
// so find the navbar it should use within it's active Tab
viewCtrl.navbarView = () => {
let activeTab = this.getActive();
if (activeTab && activeTab.instance) {
return activeTab.instance.navbarView();
}
};
// a Tabs ViewController should not have a back button
// enableBack back button will later be determined
// by the active ViewController that has a navbar
viewCtrl.enableBack = () => {
return false;
};
viewCtrl.onReady = () => {
return this._ready;
};
}
}
/**
* @private
* TODO
*/
addTab(tab) {
this.add(tab.viewCtrl);
// return true/false if it's the initial tab
return (this.length() === 1);
}
/**
* TODO
* @param {Tab} tab TODO
* @returns {TODO} TODO
*/
select(tab) {
let enteringView = null;
if (typeof tab === 'number') {
enteringView = this.getByIndex(tab);
} else {
enteringView = this.getByInstance(tab)
}
// If we select the same tab as the active one, do some magic.
if(enteringView === this.getActive()) {
this._touchActive(tab);
return;
}
if (!enteringView || !enteringView.instance || !this.app.isEnabled()) {
return Promise.reject();
}
return new Promise(resolve => {
enteringView.instance.load(() => {
let opts = {
animate: false
};
let leavingView = this.getActive() || new ViewController();
leavingView.shouldDestroy = false;
leavingView.shouldCache = true;
this.transition(enteringView, leavingView, opts, () => {
this.highlight && this.highlight.select(tab);
this._isReady();
resolve();
});
});
});
}
/**
* @private
* "Touch" the active tab, either going back to the root view of the tab
* or scrolling the tab to the top
*/
_touchActive(tab) {
let stateLen = tab.length();
if(stateLen > 1) {
// Pop to the root view
tab.popToRoot();
}
}
/**
* TODO
* @return TODO
*/
get tabs() {
return this.instances();
}
}
/**
* @private
* TODO
*/
@Directive({
selector: '.tab-button',
properties: ['tab'],
host: {
'[attr.id]': 'btnId',
'[attr.aria-controls]': 'panelId',
'[attr.aria-selected]': 'tab.isSelected',
'[class.has-title]': 'hasTitle',
'[class.has-icon]': 'hasIcon',
'[class.has-title-only]': 'hasTitleOnly',
'[class.icon-only]': 'hasIconOnly',
'(click)': 'onClick($event)',
}
})
class TabButton extends Ion {
constructor(@Host() tabs: Tabs, config: IonicConfig, elementRef: ElementRef) {
super(elementRef, config);
this.tabs = tabs;
if (config.get('hoverCSS') === false) {
elementRef.nativeElement.classList.add('disable-hover');
}
}
onInit() {
this.tab.btn = this;
let id = this.tab.viewCtrl.id;
this.btnId = 'tab-button-' + id;
this.panelId = 'tab-panel-' + id;
this.hasTitle = !!this.tab.tabTitle;
this.hasIcon = !!this.tab.tabIcon;
this.hasTitleOnly = (this.hasTitle && !this.hasIcon);
this.hasIconOnly = (this.hasIcon && !this.hasTitle);
}
onClick(ev) {
ev.stopPropagation();
ev.preventDefault();
this.tabs.select(this.tab);
}
}
/**
* @private
* TODO
*/
@Directive({
selector: 'tab-highlight'
})
class TabHighlight {
constructor(@Host() tabs: Tabs, config: IonicConfig, elementRef: ElementRef) {
if (config.get('mode') === 'md') {
tabs.highlight = this;
this.elementRef = elementRef;
}
}
select(tab) {
setTimeout(() => {
let d = tab.btn.getDimensions();
let ele = this.elementRef.nativeElement;
ele.style.transform = 'translate3d(' + d.left + 'px,0,0) scaleX(' + d.width + ')';
if (!this.init) {
this.init = true;
setTimeout(() => {
ele.classList.add('animate');
}, 64)
}
}, 32);
}
}
/**
* @private
* TODO
*/
@Directive({selector: 'template[navbar-anchor]'})
class TabNavBarAnchor {
constructor(
@Host() tabs: Tabs,
viewContainerRef: ViewContainerRef
) {
tabs.navbarContainerRef = viewContainerRef;
}
}
| ionic/components/tabs/tabs.ts | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.003011502791196108,
0.00027989543741568923,
0.00016253217472694814,
0.00017001030209939927,
0.0005032834596931934
]
|
{
"id": 8,
"code_window": [
" transform: translateX(0);\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n"
],
"labels": [
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 55
} | import {App, IonicView, IonicApp, IonicConfig, IonicPlatform} from 'ionic/ionic';
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
@App({
templateUrl: 'main.html'
})
class MyAppCmp {
constructor(modal: Modal, app: IonicApp, config: IonicConfig, platform: IonicPlatform) {
this.modal = modal;
console.log('platforms', platform.platforms());
console.log('mode', config.get('mode'));
console.log('core', platform.is('core'))
console.log('cordova', platform.is('cordova'))
console.log('mobile', platform.is('mobile'))
console.log('ipad', platform.is('ipad'))
console.log('iphone', platform.is('iphone'))
console.log('phablet', platform.is('phablet'))
console.log('tablet', platform.is('tablet'))
console.log('ios', platform.is('ios'))
console.log('android', platform.is('android'))
console.log('windows phone', platform.is('windowsphone'))
console.log('isRTL', app.isRTL())
platform.ready().then(() => {
console.log('platform.ready')
});
}
openModal() {
this.modal.open(ContactModal, {
enterAnimation: 'my-fade-in',
leaveAnimation: 'my-fade-out',
handle: 'my-awesome-modal'
});
}
}
@IonicView({
template: '<ion-nav [root]="rootView"></ion-nav>'
})
export class ContactModal {
constructor() {
console.log('ContactModal constructor')
this.rootView = ModalFirstPage;
}
onViewLoaded() {
console.log('ContactModal onViewLoaded');
}
onViewWillEnter() {
console.log('ContactModal onViewWillEnter');
}
onViewDidEnter() {
console.log('ContactModal onViewDidEnter');
}
onViewWillLeave() {
console.log('ContactModal onViewWillLeave');
}
onViewDidLeave() {
console.log('ContactModal onViewDidLeave');
}
onViewWillUnload() {
console.log('ContactModal onViewWillUnload');
}
onViewDidUnload() {
console.log('ContactModal onViewDidUnload');
}
}
@IonicView({
template: `
<ion-navbar *navbar><ion-title>First Page Header</ion-title><ion-nav-items primary><button (click)="closeModal()">Close</button></ion-nav-items></ion-navbar>
<ion-content padding>
<p>
<button (click)="push()">Push (Go to 2nd)</button>
</p>
<p>
<button (click)="openActionSheet()">Open Action Sheet</button>
</p>
<p>
<button (click)="closeByHandeModal()">Close By Handle</button>
</p>
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
</ion-content>
`
})
export class ModalFirstPage {
constructor(
nav: NavController,
modal: Modal,
actionSheet: ActionSheet
) {
this.nav = nav;
this.modal = modal;
this.actionSheet = actionSheet;
}
push() {
this.nav.push(ModalSecondPage, { id: 8675309, myData: [1,2,3,4] }, { animation: 'ios' });
}
closeModal() {
let modal = this.modal.get();
modal.close();
}
closeByHandeModal() {
let modal = this.modal.get('my-awesome-modal');
modal.close();
}
openActionSheet() {
this.actionSheet.open({
buttons: [
{ text: 'Share This' },
{ text: 'Move' }
],
destructiveText: 'Delete',
titleText: 'Modify your album',
cancelText: 'Cancel',
cancel: function() {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: function(index) {
console.log('Button clicked', index);
if(index == 1) { return false; }
return true;
}
}).then(actionSheetRef => {
this.actionSheetRef = actionSheetRef;
});
}
}
@IonicView({
template: `
<ion-navbar *navbar><ion-title>Second Page Header</ion-title></ion-navbar>
<ion-content padding>
<p>
<button (click)="nav.pop()">Pop (Go back to 1st)</button>
</p>
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
</ion-content>
`
})
export class ModalSecondPage {
constructor(
nav: NavController,
params: NavParams
) {
this.nav = nav;
this.params = params;
console.log('Second page params:', params);
}
}
class FadeIn extends Animation {
constructor(element) {
super(element);
this
.easing('ease')
.duration(450)
.fadeIn();
}
}
Animation.register('my-fade-in', FadeIn);
class FadeOut extends Animation {
constructor(element) {
super(element);
this
.easing('ease')
.duration(250)
.fadeOut();
}
}
Animation.register('my-fade-out', FadeOut);
| demos/modal/index.ts | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00017613913223613054,
0.00016992590099107474,
0.00016359738947357982,
0.00016917871835175902,
0.000003596159331209492
]
|
{
"id": 9,
"code_window": [
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
"}\n",
"\n",
"&.hairlines .search-bar {\n",
" border-bottom-width: 0.55px;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 60
} | import {ElementRef, Pipe, NgControl, Renderer} from 'angular2/angular2';
//import {ControlGroup} from 'angular2/forms'
import {Ion} from '../ion';
import {IonicConfig} from '../../config/config';
import {IonicComponent, IonicView} from '../../config/decorators';
/**
* TODO
*/
@IonicComponent({
selector: 'ion-search-bar',
appInjector: [NgControl],
properties: [
'list',
'query'
],
defaultProperties: {
'cancelText': 'Cancel',
'placeholder': 'Search'
}
})
@IonicView({
template: `
<div class="search-bar-input-container" [class.left-align]="shouldLeftAlign">
<div class="search-bar-icon"></div>
<input (focus)="inputFocused()" (blur)="inputBlurred()"
(input)="inputChanged($event)" class="search-bar-input" type="search" [attr.placeholder]="placeholder">
<div class="search-bar-close-icon"></div>
</div>
<button class="search-bar-cancel">{{cancelText}}</button>`
})
export class SearchBar extends Ion {
/**
* TODO
* @param {ElementRef} elementRef TODO
* @param {IonicConfig} config TODO
*/
constructor(
elementRef: ElementRef,
config: IonicConfig,
ngControl: NgControl,
renderer: Renderer
) {
super(elementRef, config);
this.renderer = renderer;
this.elementRef = elementRef;
if(!ngControl) {
// They don't want to do anything that works, so we won't do anything that breaks
return;
}
this.ngControl = ngControl;
ngControl.valueAccessor = this;
this.query = '';
}
/**
* Much like ngModel, this is called from our valueAccessor for the attached
* ControlDirective to update the value internally.
*/
writeValue(value) {
this.value = value;
console.log('writeValue', value);
this.renderer.setElementProperty(this.elementRef, 'value', this.value);
}
registerOnChange(val) {
console.log('registerONChange', val);
}
registerOnTouched(val) {
console.log('register on touched', val);
}
inputChanged(event) {
this.value = event.target.value;
console.log('Search changed', this.value);
this.ngControl.valueAccessor.writeValue(this.value);
this.ngControl.control.updateValue(this.value);
// this.ngControl.valueAccessor.updateValue(this.value);
// this.ngControl.updateValue(this.value);
// TODO: Better way to do this?
//this.controlDirective._control().updateValue(event.target.value);
}
inputFocused() {
this.isFocused = true;
this.shouldLeftAlign = true;
}
inputBlurred() {
this.isFocused = false;
this.shouldLeftAlign = this.value.trim() != '';
}
}
/*
export class SearchPipe extends Pipe {
constructor() {
super();
this.state = 0;
}
supports(newValue) {
return true;
}
transform(value, ...args) {
console.log('Transforming', value, args);
return value;
//return `${value} state:${this.state ++}`;
}
create(cdRef) {
console.log('REF', cdRef);
return new SearchPipe(cdRef);
}
}
*/
| ionic/components/search-bar/search-bar.ts | 1 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.0006863548769615591,
0.00023839353525545448,
0.00016732231597416103,
0.0001694071979727596,
0.000163723059813492
]
|
{
"id": 9,
"code_window": [
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
"}\n",
"\n",
"&.hairlines .search-bar {\n",
" border-bottom-width: 0.55px;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 60
} |
<!-- <ion-view nav-title="Search Bar"> -->
<ion-content>
<form [ng-form-model]="form">
<ion-search-bar ng-control="searchQuery"></ion-search-bar>
<ion-list inset #list>
<ion-item *ng-for="#item of getItems()">
{{item.title}}
</ion-item>
</ion-list>
</form>
</ion-content>
<!-- </ion-view> -->
| ionic/components/search-bar/test/basic/main.html | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00016852350381668657,
0.00016794397379271686,
0.00016736444376874715,
0.00016794397379271686,
5.795300239697099e-7
]
|
{
"id": 9,
"code_window": [
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
"}\n",
"\n",
"&.hairlines .search-bar {\n",
" border-bottom-width: 0.55px;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 60
} | // Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
| scripts/resources/web-animations-js/templates/boilerplate | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.0001755116245476529,
0.00017479894449934363,
0.00017408626445103437,
0.00017479894449934363,
7.126800483092666e-7
]
|
{
"id": 9,
"code_window": [
" }\n",
" .search-bar-input {\n",
" padding-left: 28px;\n",
" -webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" -moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);\n",
" }\n",
"}\n",
"\n",
"&.hairlines .search-bar {\n",
" border-bottom-width: 0.55px;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" transition: $search-bar-ios-input-transition;\n"
],
"file_path": "ionic/components/search-bar/modes/ios.scss",
"type": "replace",
"edit_start_line_idx": 60
} | ionic/components/button/test/outline/e2e.ts | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00019965905812568963,
0.00019965905812568963,
0.00019965905812568963,
0.00019965905812568963,
0
]
|
|
{
"id": 10,
"code_window": [
" }\n",
"})\n",
"@IonicView({\n",
" template: `\n",
" <div class=\"search-bar-input-container\" [class.left-align]=\"shouldLeftAlign\">\n",
" <div class=\"search-bar-icon\"></div>\n",
" <input (focus)=\"inputFocused()\" (blur)=\"inputBlurred()\"\n",
" (input)=\"inputChanged($event)\" class=\"search-bar-input\" type=\"search\" [attr.placeholder]=\"placeholder\">\n",
" <div class=\"search-bar-close-icon\"></div>\n",
" </div>\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <div class=\"search-bar-search-icon\"></div>\n"
],
"file_path": "ionic/components/search-bar/search-bar.ts",
"type": "replace",
"edit_start_line_idx": 25
} |
// iOS Search Bar
// --------------------------------------------------
$search-bar-ios-background-color: rgba(0, 0, 0, 0.2) !default;
$search-bar-ios-border-color: rgba(0, 0, 0, 0.05) !default;
$search-bar-ios-padding: 0 8px !default;
$search-bar-ios-input-height: 28px !default;
$search-bar-ios-input-text-color: #9D9D9D !default;
$search-bar-ios-input-background-color: #FFFFFF !default;
$search-bar-ios-input-icon-color: #767676 !default;
$search-bar-ios-input-background-svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13'><path fill='" + $search-bar-ios-input-icon-color + "' d='M5,1c2.2,0,4,1.8,4,4S7.2,9,5,9S1,7.2,1,5S2.8,1,5,1 M5,0C2.2,0,0,2.2,0,5s2.2,5,5,5s5-2.2,5-5S7.8,0,5,0 L5,0z'/><line stroke='#939398' stroke-miterlimit='10' x1='12.6' y1='12.6' x2='8.2' y2='8.2'/></svg>" !default;
$search-bar-ios-background-size: 13px 13px !default;
.search-bar {
padding: $search-bar-ios-padding;
background: $search-bar-ios-background-color;
border-bottom: 1px solid $search-bar-ios-border-color;
}
.search-bar-icon {
width: 100%;
height: 13px;
transform: translateX(calc(50% - 60px));
@include svg-background-image($search-bar-ios-input-background-svg);
background-size: $search-bar-ios-background-size;
background-repeat: no-repeat;
position: absolute;
left: 10px;
top: 8px;
}
.search-bar-input {
height: $search-bar-ios-input-height;
padding: 0 28px;
font-size: 1.4rem;
font-weight: 400;
border-radius: 5px;
color: $search-bar-ios-input-text-color;
background-color: $search-bar-ios-input-background-color;
background-repeat: no-repeat;
background-position: 8px center;
@include calc(padding-left, "50% - 28px");
}
.search-bar-input-container.left-align {
.search-bar-icon {
transform: translateX(0);
-webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);
-moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);
}
.search-bar-input {
padding-left: 28px;
-webkit-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);
-moz-transition: all 0.3s cubic-bezier(.25, .45, .05, 1);
}
}
&.hairlines .search-bar {
border-bottom-width: 0.55px;
}
| ionic/components/search-bar/modes/ios.scss | 1 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.0015136458678171039,
0.0005300528137013316,
0.00016708970360923558,
0.0002251648111268878,
0.00046769974869675934
]
|
{
"id": 10,
"code_window": [
" }\n",
"})\n",
"@IonicView({\n",
" template: `\n",
" <div class=\"search-bar-input-container\" [class.left-align]=\"shouldLeftAlign\">\n",
" <div class=\"search-bar-icon\"></div>\n",
" <input (focus)=\"inputFocused()\" (blur)=\"inputBlurred()\"\n",
" (input)=\"inputChanged($event)\" class=\"search-bar-input\" type=\"search\" [attr.placeholder]=\"placeholder\">\n",
" <div class=\"search-bar-close-icon\"></div>\n",
" </div>\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <div class=\"search-bar-search-icon\"></div>\n"
],
"file_path": "ionic/components/search-bar/search-bar.ts",
"type": "replace",
"edit_start_line_idx": 25
} | import {SlideGesture} from 'ionic/gestures/slide-gesture';
import {defaults} from '../util/util';
import {windowDimensions} from '../util/dom';
export class SlideEdgeGesture extends SlideGesture {
constructor(element: Element, opts: Object = {}) {
defaults(opts, {
edge: 'left',
threshold: 50
});
super(element, opts);
// Can check corners through use of eg 'left top'
this.edges = opts.edge.split(' ');
this.threshold = opts.threshold;
}
canStart(ev) {
this._d = this.getContainerDimensions();
return this.edges.every(edge => this._checkEdge(edge, ev.center));
}
getContainerDimensions() {
return {
left: 0,
top: 0,
width: windowDimensions().width,
height: windowDimensions().height
};
}
_checkEdge(edge, pos) {
switch (edge) {
case 'left': return pos.x <= this._d.left + this.threshold;
case 'right': return pos.x >= this._d.width - this.threshold;
case 'top': return pos.y <= this._d.top + this.threshold;
case 'bottom': return pos.y >= this._d.height - this.threshold;
}
}
}
| ionic/gestures/slide-edge-gesture.ts | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00017377462063450366,
0.00017046548600774258,
0.000165403718710877,
0.00017185445176437497,
0.000002887248456318048
]
|
{
"id": 10,
"code_window": [
" }\n",
"})\n",
"@IonicView({\n",
" template: `\n",
" <div class=\"search-bar-input-container\" [class.left-align]=\"shouldLeftAlign\">\n",
" <div class=\"search-bar-icon\"></div>\n",
" <input (focus)=\"inputFocused()\" (blur)=\"inputBlurred()\"\n",
" (input)=\"inputChanged($event)\" class=\"search-bar-input\" type=\"search\" [attr.placeholder]=\"placeholder\">\n",
" <div class=\"search-bar-close-icon\"></div>\n",
" </div>\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <div class=\"search-bar-search-icon\"></div>\n"
],
"file_path": "ionic/components/search-bar/search-bar.ts",
"type": "replace",
"edit_start_line_idx": 25
} |
<ion-toolbar><ion-title>Advanced Cards</ion-title></ion-toolbar>
<ion-content class="outer-content">
<ion-card>
<div>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==">
</div>
<ion-card-content>
<h2 class="card-title">
Card Title Goes Here
</h2>
<p>
Keep close to Nature's heart... and break clear away,
once in awhile, and climb a mountain. I am within a paragraph element.
</p>
</ion-card-content>
<ion-item actions>
<button clear item-left>
<icon star></icon>
Favorite
</button>
<button clear item-right>
<icon share></icon>
Share
</button>
</ion-item>
</ion-card>
<ion-card>
<ion-item>
<ion-avatar item-left>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==">
</ion-avatar>
<h2>Card With An Inset Picture</h2>
<p>Isn't it beautiful</p>
</ion-item>
<div>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==">
</div>
<ion-card-content>
<p>Hello. I am a paragraph.</p>
</ion-card-content>
</ion-card>
</ion-content>
<style>
img {
height: 100px;
}
</style>
| ionic/components/card/test/advanced/main.html | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00017323545762337744,
0.00017148339247796685,
0.00016789446817710996,
0.0001719744614092633,
0.000001944472160175792
]
|
{
"id": 10,
"code_window": [
" }\n",
"})\n",
"@IonicView({\n",
" template: `\n",
" <div class=\"search-bar-input-container\" [class.left-align]=\"shouldLeftAlign\">\n",
" <div class=\"search-bar-icon\"></div>\n",
" <input (focus)=\"inputFocused()\" (blur)=\"inputBlurred()\"\n",
" (input)=\"inputChanged($event)\" class=\"search-bar-input\" type=\"search\" [attr.placeholder]=\"placeholder\">\n",
" <div class=\"search-bar-close-icon\"></div>\n",
" </div>\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <div class=\"search-bar-search-icon\"></div>\n"
],
"file_path": "ionic/components/search-bar/search-bar.ts",
"type": "replace",
"edit_start_line_idx": 25
} | var ts = require('typescript');
var LEADING_STAR = /^[^\S\r\n]*\*[^\S\n\r]?/gm;
module.exports = function getContent() {
return function(symbol) {
var content = "";
if (!symbol.declarations) return content;
symbol.declarations.forEach(function(declaration) {
// If this is left side of dotted module declaration, there is no doc comment associated with this declaration
if (declaration.kind === ts.SyntaxKind.ModuleDeclaration && declaration.body.kind === ts.SyntaxKind.ModuleDeclaration) {
return content;
}
// If this is dotted module name, get the doc comments from the parent
while (declaration.kind === ts.SyntaxKind.ModuleDeclaration && declaration.parent.kind === ts.SyntaxKind.ModuleDeclaration) {
declaration = declaration.parent;
}
// If this is a variable declaration then we get the doc comments from the grand parent
if (declaration.kind === ts.SyntaxKind.VariableDeclaration) {
declaration = declaration.parent.parent;
}
// Get the source file of this declaration
var sourceFile = ts.getSourceFileOfNode(declaration);
var commentRanges = ts.getJsDocComments(declaration, sourceFile);
if (commentRanges) {
commentRanges.forEach(function(commentRange) {
content += sourceFile.text
.substring(commentRange.pos+ '/**'.length, commentRange.end - '*/'.length)
.replace(LEADING_STAR, '')
.trim();
if (commentRange.hasTrailingNewLine) {
content += '\n';
}
});
}
content += '\n';
});
return content;
};
}; | scripts/docs/typescript-package/services/tsParser/getContent.js | 0 | https://github.com/ionic-team/ionic-framework/commit/058e28c094320b6f731191fd427a24c7c56d3abc | [
0.00017430001753382385,
0.00017249432858079672,
0.00017017732898239046,
0.00017336220480501652,
0.0000016895439785002964
]
|
{
"id": 0,
"code_window": [
" \"warning\",\n",
" \"error\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enabled\": {\n",
" \"type\": \"string\",\n",
" \"enum\": [\n",
" \"prompt\",\n",
" \"always\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enabled\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 518
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as picomatch from 'picomatch';
import * as vscode from 'vscode';
import { TextDocumentEdit } from 'vscode-languageclient';
import * as nls from 'vscode-nls';
import { MdLanguageClient } from '../client/client';
import { Delayer } from '../util/async';
import { noopToken } from '../util/cancellation';
import { Disposable } from '../util/dispose';
import { looksLikeMarkdownPath } from '../util/file';
import { convertRange } from './fileReferences';
const localize = nls.loadMessageBundle();
const settingNames = Object.freeze({
enabled: 'experimental.updateLinksOnFileMove.enabled',
externalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',
enableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',
});
const enum UpdateLinksOnFileMoveSetting {
Prompt = 'prompt',
Always = 'always',
Never = 'never',
}
interface RenameAction {
readonly oldUri: vscode.Uri;
readonly newUri: vscode.Uri;
}
class UpdateLinksOnFileRenameHandler extends Disposable {
private readonly _delayer = new Delayer(50);
private readonly _pendingRenames = new Set<RenameAction>();
public constructor(
private readonly client: MdLanguageClient,
) {
super();
this._register(vscode.workspace.onDidRenameFiles(async (e) => {
for (const { newUri, oldUri } of e.files) {
const config = vscode.workspace.getConfiguration('markdown', newUri);
if (!await this.shouldParticipateInLinkUpdate(config, newUri)) {
continue;
}
this._pendingRenames.add({ newUri, oldUri });
}
if (this._pendingRenames.size) {
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('renameProgress.title', "Checking for Markdown links to update")
}, () => this.flushRenames());
});
}
}));
}
private async flushRenames(): Promise<void> {
const renames = Array.from(this._pendingRenames);
this._pendingRenames.clear();
const result = await this.getEditsForFileRename(renames, noopToken);
if (result && result.edit.size) {
if (await this.confirmActionWithUser(result.resourcesBeingRenamed)) {
await vscode.workspace.applyEdit(result.edit);
}
}
}
private async confirmActionWithUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
switch (setting) {
case UpdateLinksOnFileMoveSetting.Prompt:
return this.promptUser(newResources);
case UpdateLinksOnFileMoveSetting.Always:
return true;
case UpdateLinksOnFileMoveSetting.Never:
default:
return false;
}
}
private async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
if (setting === UpdateLinksOnFileMoveSetting.Never) {
return false;
}
if (looksLikeMarkdownPath(newUri)) {
return true;
}
const externalGlob = config.get<string>(settingNames.externalFileGlobs);
if (!!externalGlob && picomatch.isMatch(newUri.fsPath, externalGlob)) {
return true;
}
const stat = await vscode.workspace.fs.stat(newUri);
if (stat.type === vscode.FileType.Directory) {
return config.get<boolean>(settingNames.enableForDirectories, true);
}
return false;
}
private async promptUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const rejectItem: vscode.MessageItem = {
title: localize('reject.title', "No"),
isCloseAffordance: true,
};
const acceptItem: vscode.MessageItem = {
title: localize('accept.title', "Yes"),
};
const alwaysItem: vscode.MessageItem = {
title: localize('always.title', "Always automatically update Markdown Links"),
};
const neverItem: vscode.MessageItem = {
title: localize('never.title', "Never automatically update Markdown Links"),
};
const choice = await vscode.window.showInformationMessage(
newResources.length === 1
? localize('prompt', "Update Markdown links for '{0}'?", path.basename(newResources[0].fsPath))
: this.getConfirmMessage(localize('promptMoreThanOne', "Update Markdown link for the following {0} files?", newResources.length), newResources), {
modal: true,
}, rejectItem, acceptItem, alwaysItem, neverItem);
switch (choice) {
case acceptItem: {
return true;
}
case rejectItem: {
return false;
}
case alwaysItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Always,
this.getConfigTargetScope(config, settingNames.enabled));
return true;
}
case neverItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Never,
this.getConfigTargetScope(config, settingNames.enabled));
return false;
}
default: {
return false;
}
}
}
private async getEditsForFileRename(renames: readonly RenameAction[], token: vscode.CancellationToken): Promise<{ edit: vscode.WorkspaceEdit; resourcesBeingRenamed: vscode.Uri[] } | undefined> {
const result = await this.client.getEditForFileRenames(renames.map(rename => ({ oldUri: rename.oldUri.toString(), newUri: rename.newUri.toString() })), token);
if (!result?.edit.documentChanges?.length) {
return undefined;
}
const workspaceEdit = new vscode.WorkspaceEdit();
for (const change of result.edit.documentChanges as TextDocumentEdit[]) {
const uri = vscode.Uri.parse(change.textDocument.uri);
for (const edit of change.edits) {
workspaceEdit.replace(uri, convertRange(edit.range), edit.newText);
}
}
return {
edit: workspaceEdit,
resourcesBeingRenamed: result.participatingRenames.map(x => vscode.Uri.parse(x.newUri)),
};
}
private getConfirmMessage(start: string, resourcesToConfirm: readonly vscode.Uri[]): string {
const MAX_CONFIRM_FILES = 10;
const paths = [start];
paths.push('');
paths.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => path.basename(r.fsPath)));
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
paths.push(localize('moreFile', "...1 additional file not shown"));
} else {
paths.push(localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
}
}
paths.push('');
return paths.join('\n');
}
private getConfigTargetScope(config: vscode.WorkspaceConfiguration, settingsName: string): vscode.ConfigurationTarget {
const inspected = config.inspect(settingsName);
if (inspected?.workspaceFolderValue) {
return vscode.ConfigurationTarget.WorkspaceFolder;
}
if (inspected?.workspaceValue) {
return vscode.ConfigurationTarget.Workspace;
}
return vscode.ConfigurationTarget.Global;
}
}
export function registerUpdateLinksOnRename(client: MdLanguageClient) {
return new UpdateLinksOnFileRenameHandler(client);
}
| extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.02857412025332451,
0.001732003758661449,
0.00016272631182800978,
0.0001713835372356698,
0.005801583174616098
]
|
{
"id": 0,
"code_window": [
" \"warning\",\n",
" \"error\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enabled\": {\n",
" \"type\": \"string\",\n",
" \"enum\": [\n",
" \"prompt\",\n",
" \"always\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enabled\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 518
} | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#import "UseQuotes.h"
#import <Use/GTLT.h>
/*
Multi
Line
Comments
*/
@implementation Test
- (void) applicationWillFinishLaunching:(NSNotification *)notification
{
}
- (IBAction)onSelectInput:(id)sender
{
NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"ipa", @"xcarchive", @"app", nil]];
[panel beginWithCompletionHandler:^(NSInteger result)
{
if (result == NSFileHandlingPanelOKButton)
[self.inputTextField setStringValue:[panel.URL path]];
}];
return YES;
int hex = 0xFEF1F0F;
float ing = 3.14;
ing = 3.14e0;
ing = 31.4e-2;
}
-(id) initWithParams:(id<anObject>) aHandler withDeviceStateManager:(id<anotherObject>) deviceStateManager
{
// add a tap gesture recognizer
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
NSMutableArray *gestureRecognizers = [NSMutableArray array];
[gestureRecognizers addObject:tapGesture];
[gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];
scnView.gestureRecognizers = gestureRecognizers;
return tapGesture;
return nil;
}
@end
| extensions/vscode-colorize-tests/test/colorize-fixtures/test.mm | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001745539775583893,
0.00017002354434225708,
0.0001660375128267333,
0.0001692541263764724,
0.000003297003559055156
]
|
{
"id": 0,
"code_window": [
" \"warning\",\n",
" \"error\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enabled\": {\n",
" \"type\": \"string\",\n",
" \"enum\": [\n",
" \"prompt\",\n",
" \"always\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enabled\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 518
} | "use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
if (process.argv.length !== 3) {
console.error('Usage: node listNodeModules.js OUTPUT_FILE');
process.exit(-1);
}
const ROOT = path.join(__dirname, '../../../');
function findNodeModulesFiles(location, inNodeModules, result) {
const entries = fs.readdirSync(path.join(ROOT, location));
for (const entry of entries) {
const entryPath = `${location}/${entry}`;
if (/(^\/out)|(^\/src$)|(^\/.git$)|(^\/.build$)/.test(entryPath)) {
continue;
}
let stat;
try {
stat = fs.statSync(path.join(ROOT, entryPath));
}
catch (err) {
continue;
}
if (stat.isDirectory()) {
findNodeModulesFiles(entryPath, inNodeModules || (entry === 'node_modules'), result);
}
else {
if (inNodeModules) {
result.push(entryPath.substr(1));
}
}
}
}
const result = [];
findNodeModulesFiles('', false, result);
fs.writeFileSync(process.argv[2], result.join('\n') + '\n');
| build/azure-pipelines/common/listNodeModules.js | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.000174321947270073,
0.00017032705363817513,
0.00016793704708106816,
0.00016902109200600535,
0.0000024988619315990945
]
|
{
"id": 0,
"code_window": [
" \"warning\",\n",
" \"error\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enabled\": {\n",
" \"type\": \"string\",\n",
" \"enum\": [\n",
" \"prompt\",\n",
" \"always\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enabled\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 518
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path="typings/require.d.ts" />
//@ts-check
'use strict';
// Simple module style to support node.js and browser environments
(function (globalThis, factory) {
// Node.js
if (typeof exports === 'object') {
module.exports = factory();
}
// Browser
else {
globalThis.MonacoBootstrapWindow = factory();
}
}(this, function () {
const bootstrapLib = bootstrap();
const preloadGlobals = sandboxGlobals();
const safeProcess = preloadGlobals.process;
/**
* @typedef {import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
*
* @param {string[]} modulePaths
* @param {(result: unknown, configuration: ISandboxConfiguration) => Promise<unknown> | undefined} resultCallback
* @param {{
* configureDeveloperSettings?: (config: ISandboxConfiguration) => {
* forceDisableShowDevtoolsOnError?: boolean,
* forceEnableDeveloperKeybindings?: boolean,
* disallowReloadKeybinding?: boolean,
* removeDeveloperKeybindingsAfterLoad?: boolean
* },
* canModifyDOM?: (config: ISandboxConfiguration) => void,
* beforeLoaderConfig?: (loaderConfig: object) => void,
* beforeRequire?: () => void
* }} [options]
*/
async function load(modulePaths, resultCallback, options) {
const isDev = !!safeProcess.env['VSCODE_DEV'];
// Error handler (node.js enabled renderers only)
let showDevtoolsOnError = isDev;
if (!safeProcess.sandboxed) {
safeProcess.on('uncaughtException', function (/** @type {string | Error} */ error) {
onUnexpectedError(error, showDevtoolsOnError);
});
}
// Await window configuration from preload
const timeout = setTimeout(() => { console.error(`[resolve window config] Could not resolve window configuration within 10 seconds, but will continue to wait...`); }, 10000);
performance.mark('code/willWaitForWindowConfig');
/** @type {ISandboxConfiguration} */
const configuration = await preloadGlobals.context.resolveConfiguration();
performance.mark('code/didWaitForWindowConfig');
clearTimeout(timeout);
// Signal DOM modifications are now OK
if (typeof options?.canModifyDOM === 'function') {
options.canModifyDOM(configuration);
}
// Developer settings
const {
forceDisableShowDevtoolsOnError,
forceEnableDeveloperKeybindings,
disallowReloadKeybinding,
removeDeveloperKeybindingsAfterLoad
} = typeof options?.configureDeveloperSettings === 'function' ? options.configureDeveloperSettings(configuration) : {
forceDisableShowDevtoolsOnError: false,
forceEnableDeveloperKeybindings: false,
disallowReloadKeybinding: false,
removeDeveloperKeybindingsAfterLoad: false
};
showDevtoolsOnError = isDev && !forceDisableShowDevtoolsOnError;
const enableDeveloperKeybindings = isDev || forceEnableDeveloperKeybindings;
let developerDeveloperKeybindingsDisposable;
if (enableDeveloperKeybindings) {
developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding);
}
// Enable ASAR support (node.js enabled renderers only)
if (!safeProcess.sandboxed) {
globalThis.MonacoBootstrap.enableASARSupport(configuration.appRoot);
}
// Get the nls configuration into the process.env as early as possible
const nlsConfig = globalThis.MonacoBootstrap.setupNLS();
let locale = nlsConfig.availableLanguages['*'] || 'en';
if (locale === 'zh-tw') {
locale = 'zh-Hant';
} else if (locale === 'zh-cn') {
locale = 'zh-Hans';
}
window.document.documentElement.setAttribute('lang', locale);
// Define `fs` as `original-fs` to disable ASAR support
// in fs-operations (node.js enabled renderers only)
if (!safeProcess.sandboxed) {
require.define('fs', [], function () {
return require.__$__nodeRequire('original-fs');
});
}
window['MonacoEnvironment'] = {};
const loaderConfig = {
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out`,
'vs/nls': nlsConfig,
preferScriptTags: true
};
// use a trusted types policy when loading via script tags
loaderConfig.trustedTypesPolicy = window.trustedTypes?.createPolicy('amdLoader', {
createScriptURL(value) {
if (value.startsWith(window.location.origin)) {
return value;
}
throw new Error(`Invalid script url: ${value}`);
}
});
// Teach the loader the location of the node modules we use in renderers
// This will enable to load these modules via <script> tags instead of
// using a fallback such as node.js require which does not exist in sandbox
const baseNodeModulesPath = isDev ? '../node_modules' : '../node_modules.asar';
loaderConfig.paths = {
'vscode-textmate': `${baseNodeModulesPath}/vscode-textmate/release/main.js`,
'vscode-oniguruma': `${baseNodeModulesPath}/vscode-oniguruma/release/main.js`,
'xterm': `${baseNodeModulesPath}/xterm/lib/xterm.js`,
'xterm-addon-canvas': `${baseNodeModulesPath}/xterm-addon-canvas/lib/xterm-addon-canvas.js`,
'xterm-addon-search': `${baseNodeModulesPath}/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-unicode11': `${baseNodeModulesPath}/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
'xterm-addon-webgl': `${baseNodeModulesPath}/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'@vscode/iconv-lite-umd': `${baseNodeModulesPath}/@vscode/iconv-lite-umd/lib/iconv-lite-umd.js`,
'jschardet': `${baseNodeModulesPath}/jschardet/dist/jschardet.min.js`,
'@vscode/vscode-languagedetection': `${baseNodeModulesPath}/@vscode/vscode-languagedetection/dist/lib/index.js`,
'vscode-regexp-languagedetection': `${baseNodeModulesPath}/vscode-regexp-languagedetection/dist/index.js`,
'tas-client-umd': `${baseNodeModulesPath}/tas-client-umd/lib/tas-client-umd.js`
};
// Allow to load built-in and other node.js modules via AMD
// which has a fallback to using node.js `require`
// (node.js enabled renderers only)
if (!safeProcess.sandboxed) {
loaderConfig.amdModulesPattern = /(^vs\/)|(^vscode-textmate$)|(^vscode-oniguruma$)|(^xterm$)|(^xterm-addon-canvas$)|(^xterm-addon-search$)|(^xterm-addon-unicode11$)|(^xterm-addon-webgl$)|(^@vscode\/iconv-lite-umd$)|(^jschardet$)|(^@vscode\/vscode-languagedetection$)|(^vscode-regexp-languagedetection$)|(^tas-client-umd$)/;
}
// Signal before require.config()
if (typeof options?.beforeLoaderConfig === 'function') {
options.beforeLoaderConfig(loaderConfig);
}
// Configure loader
require.config(loaderConfig);
// Handle pseudo NLS
if (nlsConfig.pseudo) {
require(['vs/nls'], function (nlsPlugin) {
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
});
}
// Signal before require()
if (typeof options?.beforeRequire === 'function') {
options.beforeRequire();
}
// Actually require the main module as specified
require(modulePaths, async result => {
try {
// Callback only after process environment is resolved
const callbackResult = resultCallback(result, configuration);
if (callbackResult instanceof Promise) {
await callbackResult;
if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) {
developerDeveloperKeybindingsDisposable();
}
}
} catch (error) {
onUnexpectedError(error, enableDeveloperKeybindings);
}
}, onUnexpectedError);
}
/**
* @param {boolean | undefined} disallowReloadKeybinding
* @returns {() => void}
*/
function registerDeveloperKeybindings(disallowReloadKeybinding) {
const ipcRenderer = preloadGlobals.ipcRenderer;
const extractKey =
/**
* @param {KeyboardEvent} e
*/
function (e) {
return [
e.ctrlKey ? 'ctrl-' : '',
e.metaKey ? 'meta-' : '',
e.altKey ? 'alt-' : '',
e.shiftKey ? 'shift-' : '',
e.keyCode
].join('');
};
// Devtools & reload support
const TOGGLE_DEV_TOOLS_KB = (safeProcess.platform === 'darwin' ? 'meta-alt-73' : 'ctrl-shift-73'); // mac: Cmd-Alt-I, rest: Ctrl-Shift-I
const TOGGLE_DEV_TOOLS_KB_ALT = '123'; // F12
const RELOAD_KB = (safeProcess.platform === 'darwin' ? 'meta-82' : 'ctrl-82'); // mac: Cmd-R, rest: Ctrl-R
/** @type {((e: KeyboardEvent) => void) | undefined} */
let listener = function (e) {
const key = extractKey(e);
if (key === TOGGLE_DEV_TOOLS_KB || key === TOGGLE_DEV_TOOLS_KB_ALT) {
ipcRenderer.send('vscode:toggleDevTools');
} else if (key === RELOAD_KB && !disallowReloadKeybinding) {
ipcRenderer.send('vscode:reloadWindow');
}
};
window.addEventListener('keydown', listener);
return function () {
if (listener) {
window.removeEventListener('keydown', listener);
listener = undefined;
}
};
}
/**
* @param {string | Error} error
* @param {boolean} [showDevtoolsOnError]
*/
function onUnexpectedError(error, showDevtoolsOnError) {
if (showDevtoolsOnError) {
const ipcRenderer = preloadGlobals.ipcRenderer;
ipcRenderer.send('vscode:openDevTools');
}
console.error(`[uncaught exception]: ${error}`);
if (error && typeof error !== 'string' && error.stack) {
console.error(error.stack);
}
}
/**
* @return {{ fileUriFromPath: (path: string, config: { isWindows?: boolean, scheme?: string, fallbackAuthority?: string }) => string; }}
*/
function bootstrap() {
// @ts-ignore (defined in bootstrap.js)
return window.MonacoBootstrap;
}
/**
* @return {typeof import('./vs/base/parts/sandbox/electron-sandbox/globals')}
*/
function sandboxGlobals() {
// @ts-ignore (defined in globals.js)
return window.vscode;
}
return {
load
};
}));
| src/bootstrap-window.js | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0004451870045159012,
0.00017807497351896018,
0.000162151365657337,
0.00016851909458637238,
0.00005145705654285848
]
|
{
"id": 1,
"code_window": [
" \"never\"\n",
" ],\n",
" \"markdownEnumDescriptions\": [\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%\"\n",
" ],\n",
" \"default\": \"never\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"%configuration.markdown.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.never%\"\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 526
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9816198348999023,
0.015577761456370354,
0.0001631302438909188,
0.00016799854347482324,
0.12171033769845963
]
|
{
"id": 1,
"code_window": [
" \"never\"\n",
" ],\n",
" \"markdownEnumDescriptions\": [\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%\"\n",
" ],\n",
" \"default\": \"never\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"%configuration.markdown.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.never%\"\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 526
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EventLike, reset } from 'vs/base/browser/dom';
import { BaseActionViewItem, IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { IHoverDelegate } from 'vs/base/browser/ui/iconLabel/iconHoverDelegate';
import { setupCustomHover } from 'vs/base/browser/ui/iconLabel/iconLabelHover';
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { IAction } from 'vs/base/common/actions';
import { Codicon } from 'vs/base/common/codicons';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { HiddenItemStrategy, MenuWorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
import { MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import * as colors from 'vs/platform/theme/common/colorRegistry';
import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle';
import { MENUBAR_SELECTION_BACKGROUND, MENUBAR_SELECTION_FOREGROUND, PANEL_BORDER, TITLE_BAR_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
export class CommandCenterControl {
private readonly _disposables = new DisposableStore();
private readonly _onDidChangeVisibility = new Emitter<void>();
readonly onDidChangeVisibility: Event<void> = this._onDidChangeVisibility.event;
readonly element: HTMLElement = document.createElement('div');
constructor(
windowTitle: WindowTitle,
hoverDelegate: IHoverDelegate,
@IInstantiationService instantiationService: IInstantiationService,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService
) {
this.element.classList.add('command-center');
const titleToolbar = instantiationService.createInstance(MenuWorkbenchToolBar, this.element, MenuId.CommandCenter, {
contextMenu: MenuId.TitleBarContext,
hiddenItemStrategy: HiddenItemStrategy.Ignore,
toolbarOptions: {
primaryGroup: () => true,
},
telemetrySource: 'commandCenter',
actionViewItemProvider: (action) => {
if (action instanceof MenuItemAction && action.id === 'workbench.action.quickOpen') {
class CommandCenterViewItem extends BaseActionViewItem {
constructor(action: IAction, options: IBaseActionViewItemOptions) {
super(undefined, action, options);
}
override render(container: HTMLElement): void {
super.render(container);
container.classList.add('command-center');
const left = document.createElement('span');
left.classList.add('left');
// icon (search)
const searchIcon = renderIcon(Codicon.search);
searchIcon.classList.add('search-icon');
// label: just workspace name and optional decorations
const label = this._getLabel();
const labelElement = document.createElement('span');
labelElement.classList.add('search-label');
labelElement.innerText = label;
reset(left, searchIcon, labelElement);
// icon (dropdown)
const right = document.createElement('span');
right.classList.add('right');
const dropIcon = renderIcon(Codicon.chevronDown);
reset(right, dropIcon);
reset(container, left, right);
// hovers
this._store.add(setupCustomHover(hoverDelegate, right, localize('all', "Show Search Modes...")));
const leftHover = this._store.add(setupCustomHover(hoverDelegate, left, this.getTooltip()));
// update label & tooltip when window title changes
this._store.add(windowTitle.onDidChange(() => {
leftHover.update(this.getTooltip());
labelElement.innerText = this._getLabel();
}));
}
private _getLabel(): string {
const { prefix, suffix } = windowTitle.getTitleDecorations();
let label = windowTitle.isCustomTitleFormat() ? windowTitle.getWindowTitle() : windowTitle.workspaceName;
if (!label) {
label = localize('label.dfl', "Search");
}
if (prefix) {
label = localize('label1', "{0} {1}", prefix, label);
}
if (suffix) {
label = localize('label2', "{0} {1}", label, suffix);
}
return label;
}
override getTooltip() {
// tooltip: full windowTitle
const kb = keybindingService.lookupKeybinding(action.id)?.getLabel();
const title = kb
? localize('title', "Search {0} ({1}) \u2014 {2}", windowTitle.workspaceName, kb, windowTitle.value)
: localize('title2', "Search {0} \u2014 {1}", windowTitle.workspaceName, windowTitle.value);
return title;
}
override onClick(event: EventLike, preserveFocus = false): void {
if (event instanceof MouseEvent) {
let el = event.target;
while (el instanceof HTMLElement) {
if (el.classList.contains('right')) {
quickInputService.quickAccess.show('?');
return;
}
el = el.parentElement;
}
}
super.onClick(event, preserveFocus);
}
}
return instantiationService.createInstance(CommandCenterViewItem, action, {});
} else {
return createActionViewItem(instantiationService, action, { hoverDelegate });
}
}
});
this._disposables.add(quickInputService.onShow(this._setVisibility.bind(this, false)));
this._disposables.add(quickInputService.onHide(this._setVisibility.bind(this, true)));
this._disposables.add(titleToolbar);
}
private _setVisibility(show: boolean): void {
this.element.classList.toggle('hide', !show);
this._onDidChangeVisibility.fire();
}
dispose(): void {
this._disposables.dispose();
}
}
// --- theme colors
// foreground (inactive and active)
colors.registerColor(
'commandCenter.foreground',
{ dark: TITLE_BAR_ACTIVE_FOREGROUND, hcDark: TITLE_BAR_ACTIVE_FOREGROUND, light: TITLE_BAR_ACTIVE_FOREGROUND, hcLight: TITLE_BAR_ACTIVE_FOREGROUND },
localize('commandCenter-foreground', "Foreground color of the command center"),
false
);
colors.registerColor(
'commandCenter.activeForeground',
{ dark: MENUBAR_SELECTION_FOREGROUND, hcDark: MENUBAR_SELECTION_FOREGROUND, light: MENUBAR_SELECTION_FOREGROUND, hcLight: MENUBAR_SELECTION_FOREGROUND },
localize('commandCenter-activeForeground', "Active foreground color of the command center"),
false
);
// background (inactive and active)
colors.registerColor(
'commandCenter.background',
{ dark: null, hcDark: null, light: null, hcLight: null },
localize('commandCenter-background', "Background color of the command center"),
false
);
colors.registerColor(
'commandCenter.activeBackground',
{ dark: MENUBAR_SELECTION_BACKGROUND, hcDark: MENUBAR_SELECTION_BACKGROUND, light: MENUBAR_SELECTION_BACKGROUND, hcLight: MENUBAR_SELECTION_BACKGROUND },
localize('commandCenter-activeBackground', "Active background color of the command center"),
false
);
// border: defaults to active background
colors.registerColor(
'commandCenter.border', { dark: PANEL_BORDER, hcDark: PANEL_BORDER, light: PANEL_BORDER, hcLight: PANEL_BORDER },
localize('commandCenter-border', "Border color of the command center"),
false
);
| src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001765342749422416,
0.00017213747196365148,
0.00016751675866544247,
0.00017269261297769845,
0.00000258402360486798
]
|
{
"id": 1,
"code_window": [
" \"never\"\n",
" ],\n",
" \"markdownEnumDescriptions\": [\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%\"\n",
" ],\n",
" \"default\": \"never\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"%configuration.markdown.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.never%\"\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 526
} | src/common/config.json
| extensions/github-authentication/.gitignore | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00016979791689664125,
0.00016979791689664125,
0.00016979791689664125,
0.00016979791689664125,
0
]
|
{
"id": 1,
"code_window": [
" \"never\"\n",
" ],\n",
" \"markdownEnumDescriptions\": [\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%\"\n",
" ],\n",
" \"default\": \"never\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"%configuration.markdown.updateLinksOnFileMove.enabled.prompt%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.always%\",\n",
" \"%configuration.markdown.updateLinksOnFileMove.enabled.never%\"\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 526
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { RGBA8 } from 'vs/editor/common/core/rgba';
import { Constants, getCharIndex } from './minimapCharSheet';
import { toUint8 } from 'vs/base/common/uint';
export class MinimapCharRenderer {
_minimapCharRendererBrand: void = undefined;
private readonly charDataNormal: Uint8ClampedArray;
private readonly charDataLight: Uint8ClampedArray;
constructor(charData: Uint8ClampedArray, public readonly scale: number) {
this.charDataNormal = MinimapCharRenderer.soften(charData, 12 / 15);
this.charDataLight = MinimapCharRenderer.soften(charData, 50 / 60);
}
private static soften(input: Uint8ClampedArray, ratio: number): Uint8ClampedArray {
const result = new Uint8ClampedArray(input.length);
for (let i = 0, len = input.length; i < len; i++) {
result[i] = toUint8(input[i] * ratio);
}
return result;
}
public renderChar(
target: ImageData,
dx: number,
dy: number,
chCode: number,
color: RGBA8,
foregroundAlpha: number,
backgroundColor: RGBA8,
backgroundAlpha: number,
fontScale: number,
useLighterFont: boolean,
force1pxHeight: boolean
): void {
const charWidth = Constants.BASE_CHAR_WIDTH * this.scale;
const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale;
const renderHeight = (force1pxHeight ? 1 : charHeight);
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
console.warn('bad render request outside image data');
return;
}
const charData = useLighterFont ? this.charDataLight : this.charDataNormal;
const charIndex = getCharIndex(chCode, fontScale);
const destWidth = target.width * Constants.RGBA_CHANNELS_CNT;
const backgroundR = backgroundColor.r;
const backgroundG = backgroundColor.g;
const backgroundB = backgroundColor.b;
const deltaR = color.r - backgroundR;
const deltaG = color.g - backgroundG;
const deltaB = color.b - backgroundB;
const destAlpha = Math.max(foregroundAlpha, backgroundAlpha);
const dest = target.data;
let sourceOffset = charIndex * charWidth * charHeight;
let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT;
for (let y = 0; y < renderHeight; y++) {
let column = row;
for (let x = 0; x < charWidth; x++) {
const c = (charData[sourceOffset++] / 255) * (foregroundAlpha / 255);
dest[column++] = backgroundR + deltaR * c;
dest[column++] = backgroundG + deltaG * c;
dest[column++] = backgroundB + deltaB * c;
dest[column++] = destAlpha;
}
row += destWidth;
}
}
public blockRenderChar(
target: ImageData,
dx: number,
dy: number,
color: RGBA8,
foregroundAlpha: number,
backgroundColor: RGBA8,
backgroundAlpha: number,
force1pxHeight: boolean
): void {
const charWidth = Constants.BASE_CHAR_WIDTH * this.scale;
const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale;
const renderHeight = (force1pxHeight ? 1 : charHeight);
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
console.warn('bad render request outside image data');
return;
}
const destWidth = target.width * Constants.RGBA_CHANNELS_CNT;
const c = 0.5 * (foregroundAlpha / 255);
const backgroundR = backgroundColor.r;
const backgroundG = backgroundColor.g;
const backgroundB = backgroundColor.b;
const deltaR = color.r - backgroundR;
const deltaG = color.g - backgroundG;
const deltaB = color.b - backgroundB;
const colorR = backgroundR + deltaR * c;
const colorG = backgroundG + deltaG * c;
const colorB = backgroundB + deltaB * c;
const destAlpha = Math.max(foregroundAlpha, backgroundAlpha);
const dest = target.data;
let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT;
for (let y = 0; y < renderHeight; y++) {
let column = row;
for (let x = 0; x < charWidth; x++) {
dest[column++] = colorR;
dest[column++] = colorG;
dest[column++] = colorB;
dest[column++] = destAlpha;
}
row += destWidth;
}
}
}
| src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017775104788597673,
0.0001746314374031499,
0.0001719059218885377,
0.00017445656703785062,
0.000001698271603345347
]
|
{
"id": 2,
"code_window": [
" ],\n",
" \"default\": \"never\",\n",
" \"markdownDescription\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdownDescription\": \"%configuration.markdown.updateLinksOnFileMove.enabled%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 531
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as picomatch from 'picomatch';
import * as vscode from 'vscode';
import { TextDocumentEdit } from 'vscode-languageclient';
import * as nls from 'vscode-nls';
import { MdLanguageClient } from '../client/client';
import { Delayer } from '../util/async';
import { noopToken } from '../util/cancellation';
import { Disposable } from '../util/dispose';
import { looksLikeMarkdownPath } from '../util/file';
import { convertRange } from './fileReferences';
const localize = nls.loadMessageBundle();
const settingNames = Object.freeze({
enabled: 'experimental.updateLinksOnFileMove.enabled',
externalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',
enableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',
});
const enum UpdateLinksOnFileMoveSetting {
Prompt = 'prompt',
Always = 'always',
Never = 'never',
}
interface RenameAction {
readonly oldUri: vscode.Uri;
readonly newUri: vscode.Uri;
}
class UpdateLinksOnFileRenameHandler extends Disposable {
private readonly _delayer = new Delayer(50);
private readonly _pendingRenames = new Set<RenameAction>();
public constructor(
private readonly client: MdLanguageClient,
) {
super();
this._register(vscode.workspace.onDidRenameFiles(async (e) => {
for (const { newUri, oldUri } of e.files) {
const config = vscode.workspace.getConfiguration('markdown', newUri);
if (!await this.shouldParticipateInLinkUpdate(config, newUri)) {
continue;
}
this._pendingRenames.add({ newUri, oldUri });
}
if (this._pendingRenames.size) {
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('renameProgress.title', "Checking for Markdown links to update")
}, () => this.flushRenames());
});
}
}));
}
private async flushRenames(): Promise<void> {
const renames = Array.from(this._pendingRenames);
this._pendingRenames.clear();
const result = await this.getEditsForFileRename(renames, noopToken);
if (result && result.edit.size) {
if (await this.confirmActionWithUser(result.resourcesBeingRenamed)) {
await vscode.workspace.applyEdit(result.edit);
}
}
}
private async confirmActionWithUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
switch (setting) {
case UpdateLinksOnFileMoveSetting.Prompt:
return this.promptUser(newResources);
case UpdateLinksOnFileMoveSetting.Always:
return true;
case UpdateLinksOnFileMoveSetting.Never:
default:
return false;
}
}
private async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
if (setting === UpdateLinksOnFileMoveSetting.Never) {
return false;
}
if (looksLikeMarkdownPath(newUri)) {
return true;
}
const externalGlob = config.get<string>(settingNames.externalFileGlobs);
if (!!externalGlob && picomatch.isMatch(newUri.fsPath, externalGlob)) {
return true;
}
const stat = await vscode.workspace.fs.stat(newUri);
if (stat.type === vscode.FileType.Directory) {
return config.get<boolean>(settingNames.enableForDirectories, true);
}
return false;
}
private async promptUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const rejectItem: vscode.MessageItem = {
title: localize('reject.title', "No"),
isCloseAffordance: true,
};
const acceptItem: vscode.MessageItem = {
title: localize('accept.title', "Yes"),
};
const alwaysItem: vscode.MessageItem = {
title: localize('always.title', "Always automatically update Markdown Links"),
};
const neverItem: vscode.MessageItem = {
title: localize('never.title', "Never automatically update Markdown Links"),
};
const choice = await vscode.window.showInformationMessage(
newResources.length === 1
? localize('prompt', "Update Markdown links for '{0}'?", path.basename(newResources[0].fsPath))
: this.getConfirmMessage(localize('promptMoreThanOne', "Update Markdown link for the following {0} files?", newResources.length), newResources), {
modal: true,
}, rejectItem, acceptItem, alwaysItem, neverItem);
switch (choice) {
case acceptItem: {
return true;
}
case rejectItem: {
return false;
}
case alwaysItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Always,
this.getConfigTargetScope(config, settingNames.enabled));
return true;
}
case neverItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Never,
this.getConfigTargetScope(config, settingNames.enabled));
return false;
}
default: {
return false;
}
}
}
private async getEditsForFileRename(renames: readonly RenameAction[], token: vscode.CancellationToken): Promise<{ edit: vscode.WorkspaceEdit; resourcesBeingRenamed: vscode.Uri[] } | undefined> {
const result = await this.client.getEditForFileRenames(renames.map(rename => ({ oldUri: rename.oldUri.toString(), newUri: rename.newUri.toString() })), token);
if (!result?.edit.documentChanges?.length) {
return undefined;
}
const workspaceEdit = new vscode.WorkspaceEdit();
for (const change of result.edit.documentChanges as TextDocumentEdit[]) {
const uri = vscode.Uri.parse(change.textDocument.uri);
for (const edit of change.edits) {
workspaceEdit.replace(uri, convertRange(edit.range), edit.newText);
}
}
return {
edit: workspaceEdit,
resourcesBeingRenamed: result.participatingRenames.map(x => vscode.Uri.parse(x.newUri)),
};
}
private getConfirmMessage(start: string, resourcesToConfirm: readonly vscode.Uri[]): string {
const MAX_CONFIRM_FILES = 10;
const paths = [start];
paths.push('');
paths.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => path.basename(r.fsPath)));
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
paths.push(localize('moreFile', "...1 additional file not shown"));
} else {
paths.push(localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
}
}
paths.push('');
return paths.join('\n');
}
private getConfigTargetScope(config: vscode.WorkspaceConfiguration, settingsName: string): vscode.ConfigurationTarget {
const inspected = config.inspect(settingsName);
if (inspected?.workspaceFolderValue) {
return vscode.ConfigurationTarget.WorkspaceFolder;
}
if (inspected?.workspaceValue) {
return vscode.ConfigurationTarget.Workspace;
}
return vscode.ConfigurationTarget.Global;
}
}
export function registerUpdateLinksOnRename(client: MdLanguageClient) {
return new UpdateLinksOnFileRenameHandler(client);
}
| extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.034129392355680466,
0.002663761144503951,
0.00016530390712432563,
0.00017226907948497683,
0.007499422878026962
]
|
{
"id": 2,
"code_window": [
" ],\n",
" \"default\": \"never\",\n",
" \"markdownDescription\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdownDescription\": \"%configuration.markdown.updateLinksOnFileMove.enabled%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 531
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { MdLanguageClient } from './client/client';
import { CommandManager } from './commandManager';
import * as commands from './commands/index';
import { registerPasteSupport } from './languageFeatures/copyPaste';
import { registerDiagnosticSupport } from './languageFeatures/diagnostics';
import { registerDropIntoEditorSupport } from './languageFeatures/dropIntoEditor';
import { registerFindFileReferenceSupport } from './languageFeatures/fileReferences';
import { registerUpdateLinksOnRename } from './languageFeatures/linkUpdater';
import { ILogger } from './logging';
import { MarkdownItEngine } from './markdownEngine';
import { MarkdownContributionProvider } from './markdownExtensions';
import { MdDocumentRenderer } from './preview/documentRenderer';
import { MarkdownPreviewManager } from './preview/previewManager';
import { ContentSecurityPolicyArbiter, ExtensionContentSecurityPolicyArbiter, PreviewSecuritySelector } from './preview/security';
import { loadDefaultTelemetryReporter, TelemetryReporter } from './telemetryReporter';
import { MdLinkOpener } from './util/openDocumentLink';
export function activateShared(
context: vscode.ExtensionContext,
client: MdLanguageClient,
engine: MarkdownItEngine,
logger: ILogger,
contributions: MarkdownContributionProvider,
) {
const telemetryReporter = loadDefaultTelemetryReporter();
context.subscriptions.push(telemetryReporter);
const cspArbiter = new ExtensionContentSecurityPolicyArbiter(context.globalState, context.workspaceState);
const commandManager = new CommandManager();
const opener = new MdLinkOpener(client);
const contentProvider = new MdDocumentRenderer(engine, context, cspArbiter, contributions, logger);
const previewManager = new MarkdownPreviewManager(contentProvider, logger, contributions, opener);
context.subscriptions.push(previewManager);
context.subscriptions.push(registerMarkdownLanguageFeatures(client, commandManager));
context.subscriptions.push(registerMarkdownCommands(commandManager, previewManager, telemetryReporter, cspArbiter, engine));
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(() => {
previewManager.updateConfiguration();
}));
}
function registerMarkdownLanguageFeatures(
client: MdLanguageClient,
commandManager: CommandManager,
): vscode.Disposable {
const selector: vscode.DocumentSelector = { language: 'markdown', scheme: '*' };
return vscode.Disposable.from(
// Language features
registerDiagnosticSupport(selector, commandManager),
registerDropIntoEditorSupport(selector),
registerFindFileReferenceSupport(commandManager, client),
registerPasteSupport(selector),
registerUpdateLinksOnRename(client),
);
}
function registerMarkdownCommands(
commandManager: CommandManager,
previewManager: MarkdownPreviewManager,
telemetryReporter: TelemetryReporter,
cspArbiter: ContentSecurityPolicyArbiter,
engine: MarkdownItEngine,
): vscode.Disposable {
const previewSecuritySelector = new PreviewSecuritySelector(cspArbiter, previewManager);
commandManager.register(new commands.ShowPreviewCommand(previewManager, telemetryReporter));
commandManager.register(new commands.ShowPreviewToSideCommand(previewManager, telemetryReporter));
commandManager.register(new commands.ShowLockedPreviewToSideCommand(previewManager, telemetryReporter));
commandManager.register(new commands.ShowSourceCommand(previewManager));
commandManager.register(new commands.RefreshPreviewCommand(previewManager, engine));
commandManager.register(new commands.ShowPreviewSecuritySelectorCommand(previewSecuritySelector, previewManager));
commandManager.register(new commands.ToggleLockCommand(previewManager));
commandManager.register(new commands.RenderDocument(engine));
commandManager.register(new commands.ReloadPlugins(previewManager, engine));
return commandManager;
}
| extensions/markdown-language-features/src/extension.shared.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00033509574132040143,
0.00018709275173023343,
0.00016485735250171274,
0.00016678615065757185,
0.00005249862078926526
]
|
{
"id": 2,
"code_window": [
" ],\n",
" \"default\": \"never\",\n",
" \"markdownDescription\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdownDescription\": \"%configuration.markdown.updateLinksOnFileMove.enabled%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 531
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Event } from 'vs/base/common/event';
import { assertIsDefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { ICodeEditorViewState, IDiffEditor, IDiffEditorViewState, IEditor, IEditorViewState } from 'vs/editor/common/editorCommon';
import { IEditorOptions, IResourceEditorInput, ITextResourceEditorInput, IBaseTextResourceEditorInput, IBaseUntypedEditorInput } from 'vs/platform/editor/common/editor';
import type { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IInstantiationService, IConstructorSignature, ServicesAccessor, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Registry } from 'vs/platform/registry/common/platform';
import { IEncodingSupport, ILanguageSupport } from 'vs/workbench/services/textfile/common/textfiles';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ICompositeControl, IComposite } from 'vs/workbench/common/composite';
import { FileType, IFileService } from 'vs/platform/files/common/files';
import { IPathData } from 'vs/platform/window/common/window';
import { IExtUri } from 'vs/base/common/resources';
import { Schemas } from 'vs/base/common/network';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
// Static values for editor contributions
export const EditorExtensions = {
EditorPane: 'workbench.contributions.editors',
EditorFactory: 'workbench.contributions.editor.inputFactories'
};
// Static information regarding the text editor
export const DEFAULT_EDITOR_ASSOCIATION = {
id: 'default',
displayName: localize('promptOpenWith.defaultEditor.displayName', "Text Editor"),
providerDisplayName: localize('builtinProviderDisplayName', "Built-in")
};
/**
* Side by side editor id.
*/
export const SIDE_BY_SIDE_EDITOR_ID = 'workbench.editor.sidebysideEditor';
/**
* Text diff editor id.
*/
export const TEXT_DIFF_EDITOR_ID = 'workbench.editors.textDiffEditor';
/**
* Binary diff editor id.
*/
export const BINARY_DIFF_EDITOR_ID = 'workbench.editors.binaryResourceDiffEditor';
export interface IEditorDescriptor<T extends IEditorPane> {
/**
* The unique type identifier of the editor. All instances
* of the same `IEditorPane` should have the same type
* identifier.
*/
readonly typeId: string;
/**
* The display name of the editor.
*/
readonly name: string;
/**
* Instantiates the editor pane using the provided services.
*/
instantiate(instantiationService: IInstantiationService): T;
/**
* Whether the descriptor is for the provided editor pane.
*/
describes(editorPane: T): boolean;
}
/**
* The editor pane is the container for workbench editors.
*/
export interface IEditorPane extends IComposite {
/**
* An event to notify when the `IEditorControl` in this
* editor pane changes.
*
* This can be used for editor panes that are a compound
* of multiple editor controls to signal that the active
* editor control has changed when the user clicks around.
*/
readonly onDidChangeControl: Event<void>;
/**
* An optional event to notify when the selection inside the editor
* pane changed in case the editor has a selection concept.
*
* For example, in a text editor pane, the selection changes whenever
* the cursor is set to a new location.
*/
readonly onDidChangeSelection?: Event<IEditorPaneSelectionChangeEvent>;
/**
* The assigned input of this editor.
*/
readonly input: EditorInput | undefined;
/**
* The assigned options of the editor.
*/
readonly options: IEditorOptions | undefined;
/**
* The assigned group this editor is showing in.
*/
readonly group: IEditorGroup | undefined;
/**
* The minimum width of this editor.
*/
readonly minimumWidth: number;
/**
* The maximum width of this editor.
*/
readonly maximumWidth: number;
/**
* The minimum height of this editor.
*/
readonly minimumHeight: number;
/**
* The maximum height of this editor.
*/
readonly maximumHeight: number;
/**
* An event to notify whenever minimum/maximum width/height changes.
*/
readonly onDidChangeSizeConstraints: Event<{ width: number; height: number } | undefined>;
/**
* The context key service for this editor. Should be overridden by
* editors that have their own ScopedContextKeyService
*/
readonly scopedContextKeyService: IContextKeyService | undefined;
/**
* Returns the underlying control of this editor. Callers need to cast
* the control to a specific instance as needed, e.g. by using the
* `isCodeEditor` helper method to access the text code editor.
*
* Use the `onDidChangeControl` event to track whenever the control
* changes.
*/
getControl(): IEditorControl | undefined;
/**
* Returns the current view state of the editor if any.
*
* This method is optional to override for the editor pane
* and should only be overridden when the pane can deal with
* `IEditorOptions.viewState` to be applied when opening.
*/
getViewState(): object | undefined;
/**
* An optional method to return the current selection in
* the editor pane in case the editor pane has a selection
* concept.
*
* Clients of this method will typically react to the
* `onDidChangeSelection` event to receive the current
* selection as needed.
*/
getSelection?(): IEditorPaneSelection | undefined;
/**
* Finds out if this editor is visible or not.
*/
isVisible(): boolean;
}
export interface IEditorPaneSelectionChangeEvent {
/**
* More details for how the selection was made.
*/
reason: EditorPaneSelectionChangeReason;
}
export const enum EditorPaneSelectionChangeReason {
/**
* The selection was changed as a result of a programmatic
* method invocation.
*
* For a text editor pane, this for example can be a selection
* being restored from previous view state automatically.
*/
PROGRAMMATIC = 1,
/**
* The selection was changed by the user.
*
* This typically means the user changed the selection
* with mouse or keyboard.
*/
USER,
/**
* The selection was changed as a result of editing in
* the editor pane.
*
* For a text editor pane, this for example can be typing
* in the text of the editor pane.
*/
EDIT,
/**
* The selection was changed as a result of a navigation
* action.
*
* For a text editor pane, this for example can be a result
* of selecting an entry from a text outline view.
*/
NAVIGATION,
/**
* The selection was changed as a result of a jump action
* from within the editor pane.
*
* For a text editor pane, this for example can be a result
* of invoking "Go to definition" from a symbol.
*/
JUMP
}
export interface IEditorPaneSelection {
/**
* Asks to compare this selection to another selection.
*/
compare(otherSelection: IEditorPaneSelection): EditorPaneSelectionCompareResult;
/**
* Asks to massage the provided `options` in a way
* that the selection can be restored when the editor
* is opened again.
*
* For a text editor this means to apply the selected
* line and column as text editor options.
*/
restore(options: IEditorOptions): IEditorOptions;
/**
* Only used for logging to print more info about the selection.
*/
log?(): string;
}
export const enum EditorPaneSelectionCompareResult {
/**
* The selections are identical.
*/
IDENTICAL = 1,
/**
* The selections are similar.
*
* For a text editor this can mean that the one
* selection is in close proximity to the other
* selection.
*
* Upstream clients may decide in this case to
* not treat the selection different from the
* previous one because it is not distinct enough.
*/
SIMILAR = 2,
/**
* The selections are entirely different.
*/
DIFFERENT = 3
}
export interface IEditorPaneWithSelection extends IEditorPane {
readonly onDidChangeSelection: Event<IEditorPaneSelectionChangeEvent>;
getSelection(): IEditorPaneSelection | undefined;
}
export function isEditorPaneWithSelection(editorPane: IEditorPane | undefined): editorPane is IEditorPaneWithSelection {
const candidate = editorPane as IEditorPaneWithSelection | undefined;
return !!candidate && typeof candidate.getSelection === 'function' && !!candidate.onDidChangeSelection;
}
/**
* Try to retrieve the view state for the editor pane that
* has the provided editor input opened, if at all.
*
* This method will return `undefined` if the editor input
* is not visible in any of the opened editor panes.
*/
export function findViewStateForEditor(input: EditorInput, group: GroupIdentifier, editorService: IEditorService): object | undefined {
for (const editorPane of editorService.visibleEditorPanes) {
if (editorPane.group.id === group && input.matches(editorPane.input)) {
return editorPane.getViewState();
}
}
return undefined;
}
/**
* Overrides `IEditorPane` where `input` and `group` are known to be set.
*/
export interface IVisibleEditorPane extends IEditorPane {
readonly input: EditorInput;
readonly group: IEditorGroup;
}
/**
* The text editor pane is the container for workbench text editors.
*/
export interface ITextEditorPane extends IEditorPane {
/**
* Returns the underlying text editor widget of this editor.
*/
getControl(): IEditor | undefined;
}
/**
* The text editor pane is the container for workbench text diff editors.
*/
export interface ITextDiffEditorPane extends IEditorPane {
/**
* Returns the underlying text diff editor widget of this editor.
*/
getControl(): IDiffEditor | undefined;
}
/**
* Marker interface for the control inside an editor pane. Callers
* have to cast the control to work with it, e.g. via methods
* such as `isCodeEditor(control)`.
*/
export interface IEditorControl extends ICompositeControl { }
export interface IFileEditorFactory {
/**
* The type identifier of the file editor.
*/
typeId: string;
/**
* Creates new new editor capable of showing files.
*/
createFileEditor(resource: URI, preferredResource: URI | undefined, preferredName: string | undefined, preferredDescription: string | undefined, preferredEncoding: string | undefined, preferredLanguageId: string | undefined, preferredContents: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
/**
* Check if the provided object is a file editor.
*/
isFileEditor(obj: unknown): obj is IFileEditorInput;
}
export interface IEditorFactoryRegistry {
/**
* Registers the file editor factory to use for file editors.
*/
registerFileEditorFactory(factory: IFileEditorFactory): void;
/**
* Returns the file editor factory to use for file editors.
*/
getFileEditorFactory(): IFileEditorFactory;
/**
* Registers a editor serializer for the given editor to the registry.
* An editor serializer is capable of serializing and deserializing editor
* from string data.
*
* @param editorTypeId the type identifier of the editor
* @param serializer the editor serializer for serialization/deserialization
*/
registerEditorSerializer<Services extends BrandedService[]>(editorTypeId: string, ctor: { new(...Services: Services): IEditorSerializer }): IDisposable;
/**
* Returns the editor serializer for the given editor.
*/
getEditorSerializer(editor: EditorInput): IEditorSerializer | undefined;
getEditorSerializer(editorTypeId: string): IEditorSerializer | undefined;
/**
* Starts the registry by providing the required services.
*/
start(accessor: ServicesAccessor): void;
}
export interface IEditorSerializer {
/**
* Determines whether the given editor can be serialized by the serializer.
*/
canSerialize(editor: EditorInput): boolean;
/**
* Returns a string representation of the provided editor that contains enough information
* to deserialize back to the original editor from the deserialize() method.
*/
serialize(editor: EditorInput): string | undefined;
/**
* Returns an editor from the provided serialized form of the editor. This form matches
* the value returned from the serialize() method.
*/
deserialize(instantiationService: IInstantiationService, serializedEditor: string): EditorInput | undefined;
}
export interface IUntitledTextResourceEditorInput extends IBaseTextResourceEditorInput {
/**
* Optional resource for the untitled editor. Depending on the value, the editor:
* - should get a unique name if `undefined` (for example `Untitled-1`)
* - should use the resource directly if the scheme is `untitled:`
* - should change the scheme to `untitled:` otherwise and assume an associated path
*
* Untitled editors with associated path behave slightly different from other untitled
* editors:
* - they are dirty right when opening
* - they will not ask for a file path when saving but use the associated path
*/
readonly resource: URI | undefined;
}
/**
* A resource side by side editor input shows 2 editors side by side but
* without highlighting any differences.
*
* Note: both sides will be resolved as editor individually. As such, it is
* possible to show 2 different editors side by side.
*
* @see {@link IResourceDiffEditorInput} for a variant that compares 2 editors.
*/
export interface IResourceSideBySideEditorInput extends IBaseUntypedEditorInput {
/**
* The right hand side editor to open inside a side-by-side editor.
*/
readonly primary: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
/**
* The left hand side editor to open inside a side-by-side editor.
*/
readonly secondary: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
}
/**
* A resource diff editor input compares 2 editors side by side
* highlighting the differences.
*
* Note: both sides must be resolvable to the same editor, or
* a text based presentation will be used as fallback.
*/
export interface IResourceDiffEditorInput extends IBaseUntypedEditorInput {
/**
* The left hand side editor to open inside a diff editor.
*/
readonly original: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
/**
* The right hand side editor to open inside a diff editor.
*/
readonly modified: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
}
export type IResourceMergeEditorInputSide = (IResourceEditorInput | ITextResourceEditorInput) & { detail?: string };
/**
* A resource merge editor input compares multiple editors
* highlighting the differences for merging.
*
* Note: all sides must be resolvable to the same editor, or
* a text based presentation will be used as fallback.
*/
export interface IResourceMergeEditorInput extends IBaseUntypedEditorInput {
/**
* The one changed version of the file.
*/
readonly input1: IResourceMergeEditorInputSide;
/**
* The second changed version of the file.
*/
readonly input2: IResourceMergeEditorInputSide;
/**
* The base common ancestor of the file to merge.
*/
readonly base: IResourceEditorInput | ITextResourceEditorInput;
/**
* The resulting output of the merge.
*/
readonly result: IResourceEditorInput | ITextResourceEditorInput;
}
export function isResourceEditorInput(editor: unknown): editor is IResourceEditorInput {
if (isEditorInput(editor)) {
return false; // make sure to not accidentally match on typed editor inputs
}
const candidate = editor as IResourceEditorInput | undefined;
return URI.isUri(candidate?.resource);
}
export function isResourceDiffEditorInput(editor: unknown): editor is IResourceDiffEditorInput {
if (isEditorInput(editor)) {
return false; // make sure to not accidentally match on typed editor inputs
}
const candidate = editor as IResourceDiffEditorInput | undefined;
return candidate?.original !== undefined && candidate.modified !== undefined;
}
export function isResourceSideBySideEditorInput(editor: unknown): editor is IResourceSideBySideEditorInput {
if (isEditorInput(editor)) {
return false; // make sure to not accidentally match on typed editor inputs
}
if (isResourceDiffEditorInput(editor)) {
return false; // make sure to not accidentally match on diff editors
}
const candidate = editor as IResourceSideBySideEditorInput | undefined;
return candidate?.primary !== undefined && candidate.secondary !== undefined;
}
export function isUntitledResourceEditorInput(editor: unknown): editor is IUntitledTextResourceEditorInput {
if (isEditorInput(editor)) {
return false; // make sure to not accidentally match on typed editor inputs
}
const candidate = editor as IUntitledTextResourceEditorInput | undefined;
if (!candidate) {
return false;
}
return candidate.resource === undefined || candidate.resource.scheme === Schemas.untitled || candidate.forceUntitled === true;
}
const UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX = /Untitled-\d+/;
export function isUntitledWithAssociatedResource(resource: URI): boolean {
return resource.scheme === Schemas.untitled && resource.path.length > 1 && !UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(resource.path);
}
export function isResourceMergeEditorInput(editor: unknown): editor is IResourceMergeEditorInput {
if (isEditorInput(editor)) {
return false; // make sure to not accidentally match on typed editor inputs
}
const candidate = editor as IResourceMergeEditorInput | undefined;
return URI.isUri(candidate?.base?.resource) && URI.isUri(candidate?.input1?.resource) && URI.isUri(candidate?.input2?.resource) && URI.isUri(candidate?.result?.resource);
}
export const enum Verbosity {
SHORT,
MEDIUM,
LONG
}
export const enum SaveReason {
/**
* Explicit user gesture.
*/
EXPLICIT = 1,
/**
* Auto save after a timeout.
*/
AUTO = 2,
/**
* Auto save after editor focus change.
*/
FOCUS_CHANGE = 3,
/**
* Auto save after window change.
*/
WINDOW_CHANGE = 4
}
export type SaveSource = string;
interface ISaveSourceDescriptor {
source: SaveSource;
label: string;
}
class SaveSourceFactory {
private readonly mapIdToSaveSource = new Map<SaveSource, ISaveSourceDescriptor>();
/**
* Registers a `SaveSource` with an identifier and label
* to the registry so that it can be used in save operations.
*/
registerSource(id: string, label: string): SaveSource {
let sourceDescriptor = this.mapIdToSaveSource.get(id);
if (!sourceDescriptor) {
sourceDescriptor = { source: id, label };
this.mapIdToSaveSource.set(id, sourceDescriptor);
}
return sourceDescriptor.source;
}
getSourceLabel(source: SaveSource): string {
return this.mapIdToSaveSource.get(source)?.label ?? source;
}
}
export const SaveSourceRegistry = new SaveSourceFactory();
export interface ISaveOptions {
/**
* An indicator how the save operation was triggered.
*/
reason?: SaveReason;
/**
* An indicator about the source of the save operation.
*
* Must use `SaveSourceRegistry.registerSource()` to obtain.
*/
readonly source?: SaveSource;
/**
* Forces to save the contents of the working copy
* again even if the working copy is not dirty.
*/
readonly force?: boolean;
/**
* Instructs the save operation to skip any save participants.
*/
readonly skipSaveParticipants?: boolean;
/**
* A hint as to which file systems should be available for saving.
*/
readonly availableFileSystems?: string[];
}
export interface IRevertOptions {
/**
* Forces to load the contents of the working copy
* again even if the working copy is not dirty.
*/
readonly force?: boolean;
/**
* A soft revert will clear dirty state of a working copy
* but will not attempt to load it from its persisted state.
*
* This option may be used in scenarios where an editor is
* closed and where we do not require to load the contents.
*/
readonly soft?: boolean;
}
export interface IMoveResult {
editor: EditorInput | IUntypedEditorInput;
options?: IEditorOptions;
}
export const enum EditorInputCapabilities {
/**
* Signals no specific capability for the input.
*/
None = 0,
/**
* Signals that the input is readonly.
*/
Readonly = 1 << 1,
/**
* Signals that the input is untitled.
*/
Untitled = 1 << 2,
/**
* Signals that the input can only be shown in one group
* and not be split into multiple groups.
*/
Singleton = 1 << 3,
/**
* Signals that the input requires workspace trust.
*/
RequiresTrust = 1 << 4,
/**
* Signals that the editor can split into 2 in the same
* editor group.
*/
CanSplitInGroup = 1 << 5,
/**
* Signals that the editor wants it's description to be
* visible when presented to the user. By default, a UI
* component may decide to hide the description portion
* for brevity.
*/
ForceDescription = 1 << 6,
/**
* Signals that the editor supports dropping into the
* editor by holding shift.
*/
CanDropIntoEditor = 1 << 7,
/**
* Signals that the editor is composed of multiple editors
* within.
*/
MultipleEditors = 1 << 8
}
export type IUntypedEditorInput = IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput | IResourceDiffEditorInput | IResourceSideBySideEditorInput | IResourceMergeEditorInput;
export abstract class AbstractEditorInput extends Disposable {
// Marker class for implementing `isEditorInput`
}
export function isEditorInput(editor: unknown): editor is EditorInput {
return editor instanceof AbstractEditorInput;
}
export interface EditorInputWithPreferredResource {
/**
* An editor may provide an additional preferred resource alongside
* the `resource` property. While the `resource` property serves as
* unique identifier of the editor that should be used whenever we
* compare to other editors, the `preferredResource` should be used
* in places where e.g. the resource is shown to the user.
*
* For example: on Windows and macOS, the same URI with different
* casing may point to the same file. The editor may chose to
* "normalize" the URIs so that only one editor opens for different
* URIs. But when displaying the editor label to the user, the
* preferred URI should be used.
*
* Not all editors have a `preferredResource`. The `EditorResourceAccessor`
* utility can be used to always get the right resource without having
* to do instanceof checks.
*/
readonly preferredResource: URI;
}
function isEditorInputWithPreferredResource(editor: unknown): editor is EditorInputWithPreferredResource {
const candidate = editor as EditorInputWithPreferredResource | undefined;
return URI.isUri(candidate?.preferredResource);
}
export interface ISideBySideEditorInput extends EditorInput {
/**
* The primary editor input is shown on the right hand side.
*/
primary: EditorInput;
/**
* The secondary editor input is shown on the left hand side.
*/
secondary: EditorInput;
}
export function isSideBySideEditorInput(editor: unknown): editor is ISideBySideEditorInput {
const candidate = editor as ISideBySideEditorInput | undefined;
return isEditorInput(candidate?.primary) && isEditorInput(candidate?.secondary);
}
export interface IDiffEditorInput extends EditorInput {
/**
* The modified (primary) editor input is shown on the right hand side.
*/
modified: EditorInput;
/**
* The original (secondary) editor input is shown on the left hand side.
*/
original: EditorInput;
}
export function isDiffEditorInput(editor: unknown): editor is IDiffEditorInput {
const candidate = editor as IDiffEditorInput | undefined;
return isEditorInput(candidate?.modified) && isEditorInput(candidate?.original);
}
export interface IUntypedFileEditorInput extends ITextResourceEditorInput {
/**
* A marker to create a `IFileEditorInput` from this untyped input.
*/
forceFile: true;
}
/**
* This is a tagging interface to declare an editor input being capable of dealing with files. It is only used in the editor registry
* to register this kind of input to the platform.
*/
export interface IFileEditorInput extends EditorInput, IEncodingSupport, ILanguageSupport, EditorInputWithPreferredResource {
/**
* Gets the resource this file input is about. This will always be the
* canonical form of the resource, so it may differ from the original
* resource that was provided to create the input. Use `preferredResource`
* for the form as it was created.
*/
readonly resource: URI;
/**
* Sets the preferred resource to use for this file input.
*/
setPreferredResource(preferredResource: URI): void;
/**
* Sets the preferred name to use for this file input.
*
* Note: for certain file schemes the input may decide to ignore this
* name and use our standard naming. Specifically for schemes we own,
* we do not let others override the name.
*/
setPreferredName(name: string): void;
/**
* Sets the preferred description to use for this file input.
*
* Note: for certain file schemes the input may decide to ignore this
* description and use our standard naming. Specifically for schemes we own,
* we do not let others override the description.
*/
setPreferredDescription(description: string): void;
/**
* Sets the preferred encoding to use for this file input.
*/
setPreferredEncoding(encoding: string): void;
/**
* Sets the preferred language id to use for this file input.
*/
setPreferredLanguageId(languageId: string): void;
/**
* Sets the preferred contents to use for this file input.
*/
setPreferredContents(contents: string): void;
/**
* Forces this file input to open as binary instead of text.
*/
setForceOpenAsBinary(): void;
/**
* Figure out if the file input has been resolved or not.
*/
isResolved(): boolean;
}
export interface EditorInputWithOptions {
editor: EditorInput;
options?: IEditorOptions;
}
export interface EditorInputWithOptionsAndGroup extends EditorInputWithOptions {
group: IEditorGroup;
}
export function isEditorInputWithOptions(editor: unknown): editor is EditorInputWithOptions {
const candidate = editor as EditorInputWithOptions | undefined;
return isEditorInput(candidate?.editor);
}
export function isEditorInputWithOptionsAndGroup(editor: unknown): editor is EditorInputWithOptionsAndGroup {
const candidate = editor as EditorInputWithOptionsAndGroup | undefined;
return isEditorInputWithOptions(editor) && candidate?.group !== undefined;
}
/**
* Context passed into `EditorPane#setInput` to give additional
* context information around why the editor was opened.
*/
export interface IEditorOpenContext {
/**
* An indicator if the editor input is new for the group the editor is in.
* An editor is new for a group if it was not part of the group before and
* otherwise was already opened in the group and just became the active editor.
*
* This hint can e.g. be used to decide whether to restore view state or not.
*/
newInGroup?: boolean;
}
export interface IEditorIdentifier {
groupId: GroupIdentifier;
editor: EditorInput;
}
export function isEditorIdentifier(identifier: unknown): identifier is IEditorIdentifier {
const candidate = identifier as IEditorIdentifier | undefined;
return typeof candidate?.groupId === 'number' && isEditorInput(candidate.editor);
}
/**
* The editor commands context is used for editor commands (e.g. in the editor title)
* and we must ensure that the context is serializable because it potentially travels
* to the extension host!
*/
export interface IEditorCommandsContext {
groupId: GroupIdentifier;
editorIndex?: number;
preserveFocus?: boolean;
}
/**
* More information around why an editor was closed in the model.
*/
export enum EditorCloseContext {
/**
* No specific context for closing (e.g. explicit user gesture).
*/
UNKNOWN,
/**
* The editor closed because it was replaced with another editor.
* This can either happen via explicit replace call or when an
* editor is in preview mode and another editor opens.
*/
REPLACE,
/**
* The editor closed as a result of moving it to another group.
*/
MOVE,
/**
* The editor closed because another editor turned into preview
* and this used to be the preview editor before.
*/
UNPIN
}
export interface IEditorCloseEvent extends IEditorIdentifier {
/**
* More information around why the editor was closed.
*/
readonly context: EditorCloseContext;
/**
* The index of the editor before closing.
*/
readonly index: number;
/**
* Whether the editor was sticky or not.
*/
readonly sticky: boolean;
}
export interface IActiveEditorChangeEvent {
/**
* The new active editor or `undefined` if the group is empty.
*/
editor: EditorInput | undefined;
}
export interface IEditorWillMoveEvent extends IEditorIdentifier {
/**
* The target group of the move operation.
*/
readonly target: GroupIdentifier;
}
export interface IEditorWillOpenEvent extends IEditorIdentifier { }
export type GroupIdentifier = number;
export const enum GroupModelChangeKind {
/* Group Changes */
GROUP_ACTIVE,
GROUP_INDEX,
GROUP_LOCKED,
/* Editor Changes */
EDITOR_OPEN,
EDITOR_CLOSE,
EDITOR_MOVE,
EDITOR_ACTIVE,
EDITOR_LABEL,
EDITOR_CAPABILITIES,
EDITOR_PIN,
EDITOR_STICKY,
EDITOR_DIRTY,
EDITOR_WILL_DISPOSE
}
export interface IWorkbenchEditorConfiguration {
workbench?: {
editor?: IEditorPartConfiguration;
iconTheme?: string;
};
}
interface IEditorPartConfiguration {
showTabs?: boolean;
wrapTabs?: boolean;
scrollToSwitchTabs?: boolean;
highlightModifiedTabs?: boolean;
tabCloseButton?: 'left' | 'right' | 'off';
tabSizing?: 'fit' | 'shrink';
pinnedTabSizing?: 'normal' | 'compact' | 'shrink';
titleScrollbarSizing?: 'default' | 'large';
focusRecentEditorAfterClose?: boolean;
showIcons?: boolean;
enablePreview?: boolean;
enablePreviewFromQuickOpen?: boolean;
enablePreviewFromCodeNavigation?: boolean;
closeOnFileDelete?: boolean;
openPositioning?: 'left' | 'right' | 'first' | 'last';
openSideBySideDirection?: 'right' | 'down';
closeEmptyGroups?: boolean;
autoLockGroups?: Set<string>;
revealIfOpen?: boolean;
mouseBackForwardToNavigate?: boolean;
labelFormat?: 'default' | 'short' | 'medium' | 'long';
restoreViewState?: boolean;
splitInGroupLayout?: 'vertical' | 'horizontal';
splitSizing?: 'split' | 'distribute';
splitOnDragAndDrop?: boolean;
limit?: {
enabled?: boolean;
excludeDirty?: boolean;
value?: number;
perEditorGroup?: boolean;
};
decorations?: {
badges?: boolean;
colors?: boolean;
};
}
export interface IEditorPartOptions extends IEditorPartConfiguration {
hasIcons?: boolean;
}
export interface IEditorPartOptionsChangeEvent {
oldPartOptions: IEditorPartOptions;
newPartOptions: IEditorPartOptions;
}
export enum SideBySideEditor {
PRIMARY = 1,
SECONDARY = 2,
BOTH = 3,
ANY = 4
}
export interface IFindEditorOptions {
/**
* Whether to consider any or both side by side editor as matching.
* By default, side by side editors will not be considered
* as matching, even if the editor is opened in one of the sides.
*/
supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY;
}
export interface IMatchEditorOptions {
/**
* Whether to consider a side by side editor as matching.
* By default, side by side editors will not be considered
* as matching, even if the editor is opened in one of the sides.
*/
supportSideBySide?: SideBySideEditor.ANY | SideBySideEditor.BOTH;
/**
* Only consider an editor to match when the
* `candidate === editor` but not when
* `candidate.matches(editor)`.
*/
strictEquals?: boolean;
}
export interface IEditorResourceAccessorOptions {
/**
* Allows to access the `resource(s)` of side by side editors. If not
* specified, a `resource` for a side by side editor will always be
* `undefined`.
*/
supportSideBySide?: SideBySideEditor;
/**
* Allows to filter the scheme to consider. A resource scheme that does
* not match a filter will not be considered.
*/
filterByScheme?: string | string[];
}
class EditorResourceAccessorImpl {
/**
* The original URI of an editor is the URI that was used originally to open
* the editor and should be used whenever the URI is presented to the user,
* e.g. as a label together with utility methods such as `ResourceLabel` or
* `ILabelService` that can turn this original URI into the best form for
* presenting.
*
* In contrast, the canonical URI (#getCanonicalUri) may be different and should
* be used whenever the URI is used to e.g. compare with other editors or when
* caching certain data based on the URI.
*
* For example: on Windows and macOS, the same file URI with different casing may
* point to the same file. The editor may chose to "normalize" the URI into a canonical
* form so that only one editor opens for same file URIs with different casing. As
* such, the original URI and the canonical URI can be different.
*/
getOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null): URI | undefined;
getOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY }): URI | undefined;
getOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI; secondary?: URI } | undefined;
getOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined;
getOriginalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined {
if (!editor) {
return undefined;
}
// Merge editors are handled with `merged` result editor
if (isResourceMergeEditorInput(editor)) {
return EditorResourceAccessor.getOriginalUri(editor.result, options);
}
// Optionally support side-by-side editors
if (options?.supportSideBySide) {
const { primary, secondary } = this.getSideEditors(editor);
if (primary && secondary) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {
primary: this.getOriginalUri(primary, { filterByScheme: options.filterByScheme }),
secondary: this.getOriginalUri(secondary, { filterByScheme: options.filterByScheme })
};
} else if (options?.supportSideBySide === SideBySideEditor.ANY) {
return this.getOriginalUri(primary, { filterByScheme: options.filterByScheme }) ?? this.getOriginalUri(secondary, { filterByScheme: options.filterByScheme });
}
editor = options.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;
}
}
if (isResourceDiffEditorInput(editor) || isResourceSideBySideEditorInput(editor) || isResourceMergeEditorInput(editor)) {
return undefined;
}
// Original URI is the `preferredResource` of an editor if any
const originalResource = isEditorInputWithPreferredResource(editor) ? editor.preferredResource : editor.resource;
if (!originalResource || !options || !options.filterByScheme) {
return originalResource;
}
return this.filterUri(originalResource, options.filterByScheme);
}
private getSideEditors(editor: EditorInput | IUntypedEditorInput): { primary: EditorInput | IUntypedEditorInput | undefined; secondary: EditorInput | IUntypedEditorInput | undefined } {
if (isSideBySideEditorInput(editor) || isResourceSideBySideEditorInput(editor)) {
return { primary: editor.primary, secondary: editor.secondary };
}
if (isDiffEditorInput(editor) || isResourceDiffEditorInput(editor)) {
return { primary: editor.modified, secondary: editor.original };
}
return { primary: undefined, secondary: undefined };
}
/**
* The canonical URI of an editor is the true unique identifier of the editor
* and should be used whenever the URI is used e.g. to compare with other
* editors or when caching certain data based on the URI.
*
* In contrast, the original URI (#getOriginalUri) may be different and should
* be used whenever the URI is presented to the user, e.g. as a label.
*
* For example: on Windows and macOS, the same file URI with different casing may
* point to the same file. The editor may chose to "normalize" the URI into a canonical
* form so that only one editor opens for same file URIs with different casing. As
* such, the original URI and the canonical URI can be different.
*/
getCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null): URI | undefined;
getCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY | SideBySideEditor.ANY }): URI | undefined;
getCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options: IEditorResourceAccessorOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI; secondary?: URI } | undefined;
getCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined;
getCanonicalUri(editor: EditorInput | IUntypedEditorInput | undefined | null, options?: IEditorResourceAccessorOptions): URI | { primary?: URI; secondary?: URI } | undefined {
if (!editor) {
return undefined;
}
// Merge editors are handled with `merged` result editor
if (isResourceMergeEditorInput(editor)) {
return EditorResourceAccessor.getCanonicalUri(editor.result, options);
}
// Optionally support side-by-side editors
if (options?.supportSideBySide) {
const { primary, secondary } = this.getSideEditors(editor);
if (primary && secondary) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {
primary: this.getCanonicalUri(primary, { filterByScheme: options.filterByScheme }),
secondary: this.getCanonicalUri(secondary, { filterByScheme: options.filterByScheme })
};
} else if (options?.supportSideBySide === SideBySideEditor.ANY) {
return this.getCanonicalUri(primary, { filterByScheme: options.filterByScheme }) ?? this.getCanonicalUri(secondary, { filterByScheme: options.filterByScheme });
}
editor = options.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;
}
}
if (isResourceDiffEditorInput(editor) || isResourceSideBySideEditorInput(editor) || isResourceMergeEditorInput(editor)) {
return undefined;
}
// Canonical URI is the `resource` of an editor
const canonicalResource = editor.resource;
if (!canonicalResource || !options || !options.filterByScheme) {
return canonicalResource;
}
return this.filterUri(canonicalResource, options.filterByScheme);
}
private filterUri(resource: URI, filter: string | string[]): URI | undefined {
// Multiple scheme filter
if (Array.isArray(filter)) {
if (filter.some(scheme => resource.scheme === scheme)) {
return resource;
}
}
// Single scheme filter
else {
if (filter === resource.scheme) {
return resource;
}
}
return undefined;
}
}
export const EditorResourceAccessor = new EditorResourceAccessorImpl();
export const enum CloseDirection {
LEFT,
RIGHT
}
export interface IEditorMemento<T> {
saveEditorState(group: IEditorGroup, resource: URI, state: T): void;
saveEditorState(group: IEditorGroup, editor: EditorInput, state: T): void;
loadEditorState(group: IEditorGroup, resource: URI): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;
clearEditorState(resource: URI, group?: IEditorGroup): void;
clearEditorState(editor: EditorInput, group?: IEditorGroup): void;
clearEditorStateOnDispose(resource: URI, editor: EditorInput): void;
moveEditorState(source: URI, target: URI, comparer: IExtUri): void;
}
class EditorFactoryRegistry implements IEditorFactoryRegistry {
private instantiationService: IInstantiationService | undefined;
private fileEditorFactory: IFileEditorFactory | undefined;
private readonly editorSerializerConstructors = new Map<string /* Type ID */, IConstructorSignature<IEditorSerializer>>();
private readonly editorSerializerInstances = new Map<string /* Type ID */, IEditorSerializer>();
start(accessor: ServicesAccessor): void {
const instantiationService = this.instantiationService = accessor.get(IInstantiationService);
for (const [key, ctor] of this.editorSerializerConstructors) {
this.createEditorSerializer(key, ctor, instantiationService);
}
this.editorSerializerConstructors.clear();
}
private createEditorSerializer(editorTypeId: string, ctor: IConstructorSignature<IEditorSerializer>, instantiationService: IInstantiationService): void {
const instance = instantiationService.createInstance(ctor);
this.editorSerializerInstances.set(editorTypeId, instance);
}
registerFileEditorFactory(factory: IFileEditorFactory): void {
if (this.fileEditorFactory) {
throw new Error('Can only register one file editor factory.');
}
this.fileEditorFactory = factory;
}
getFileEditorFactory(): IFileEditorFactory {
return assertIsDefined(this.fileEditorFactory);
}
registerEditorSerializer(editorTypeId: string, ctor: IConstructorSignature<IEditorSerializer>): IDisposable {
if (this.editorSerializerConstructors.has(editorTypeId) || this.editorSerializerInstances.has(editorTypeId)) {
throw new Error(`A editor serializer with type ID '${editorTypeId}' was already registered.`);
}
if (!this.instantiationService) {
this.editorSerializerConstructors.set(editorTypeId, ctor);
} else {
this.createEditorSerializer(editorTypeId, ctor, this.instantiationService);
}
return toDisposable(() => {
this.editorSerializerConstructors.delete(editorTypeId);
this.editorSerializerInstances.delete(editorTypeId);
});
}
getEditorSerializer(editor: EditorInput): IEditorSerializer | undefined;
getEditorSerializer(editorTypeId: string): IEditorSerializer | undefined;
getEditorSerializer(arg1: string | EditorInput): IEditorSerializer | undefined {
return this.editorSerializerInstances.get(typeof arg1 === 'string' ? arg1 : arg1.typeId);
}
}
Registry.add(EditorExtensions.EditorFactory, new EditorFactoryRegistry());
export async function pathsToEditors(paths: IPathData[] | undefined, fileService: IFileService): Promise<ReadonlyArray<IResourceEditorInput | IUntitledTextResourceEditorInput | undefined>> {
if (!paths || !paths.length) {
return [];
}
return await Promise.all(paths.map(async path => {
const resource = URI.revive(path.fileUri);
if (!resource) {
return undefined;
}
const canHandleResource = await fileService.canHandleResource(resource);
if (!canHandleResource) {
return undefined;
}
let exists = path.exists;
let type = path.type;
if (typeof exists !== 'boolean' || typeof type !== 'number') {
try {
type = (await fileService.stat(resource)).isDirectory ? FileType.Directory : FileType.Unknown;
exists = true;
} catch {
exists = false;
}
}
if (!exists && path.openOnlyIfExists) {
return undefined;
}
if (type === FileType.Directory) {
return undefined;
}
const options: IEditorOptions = {
...path.options,
pinned: true
};
if (!exists) {
return { resource, options, forceUntitled: true };
}
return { resource, options };
}));
}
export const enum EditorsOrder {
/**
* Editors sorted by most recent activity (most recent active first)
*/
MOST_RECENTLY_ACTIVE,
/**
* Editors sorted by sequential order
*/
SEQUENTIAL
}
export function isTextEditorViewState(candidate: unknown): candidate is IEditorViewState {
const viewState = candidate as IEditorViewState | undefined;
if (!viewState) {
return false;
}
const diffEditorViewState = viewState as IDiffEditorViewState;
if (diffEditorViewState.modified) {
return isTextEditorViewState(diffEditorViewState.modified);
}
const codeEditorViewState = viewState as ICodeEditorViewState;
return !!(codeEditorViewState.contributionsState && codeEditorViewState.viewState && Array.isArray(codeEditorViewState.cursorState));
}
| src/vs/workbench/common/editor.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0006283775437623262,
0.00018202990759164095,
0.00016090580902528018,
0.0001707350747892633,
0.00005981545109534636
]
|
{
"id": 2,
"code_window": [
" ],\n",
" \"default\": \"never\",\n",
" \"markdownDescription\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enabled%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"markdownDescription\": \"%configuration.markdown.updateLinksOnFileMove.enabled%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 531
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { range } from 'vs/base/common/arrays';
import { VSBuffer } from 'vs/base/common/buffer';
import { UTF8_BOM } from 'vs/workbench/services/textfile/common/encoding';
const fixtures: { [filename: string]: Uint8Array } = {};
export default fixtures;
// encoded from 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя'
fixtures['some_cyrillic.txt'] = Uint8Array.from([...range(128, 175 + 1), ...range(224, 239 + 1)]);
// encoded from '中国abc'
fixtures['some_gbk.txt'] = Uint8Array.from([214, 208, 185, 250, 97, 98, 99]);
// encoded from '中文abc'
fixtures['some_big5.txt'] = Uint8Array.from([164, 164, 164, 229, 97, 98, 99]);
// encoded from '中文abc'
fixtures['some_shiftjis.txt'] = Uint8Array.from([146, 134, 149, 182, 97, 98, 99]);
// encoded from 'ObjectCount = LoadObjects("Öffentlicher Ordner");\nPrivate = "Persönliche Information"'
fixtures['some_cp1252.txt'] = Uint8Array.from([
79, 98, 106, 101, 99, 116, 67, 111, 117, 110, 116, 32, 61, 32, 76, 111, 97, 100, 79, 98, 106, 101, 99, 116, 115, 40, 34, 214, 102, 102, 101, 110, 116, 108, 105, 99, 104, 101, 114, 32, 79, 114, 100, 110, 101, 114, 34, 41, 59, 10, 10, 80, 114, 105, 118, 97, 116, 101, 32, 61, 32, 34, 80, 101, 114, 115, 246, 110, 108, 105, 99, 104, 101, 32, 73, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 34, 10
]);
// encoded from 'Private = "Persönliche Information"'
fixtures['some_small_cp1252.txt'] = Uint8Array.from([
80, 114, 105, 118, 97, 116, 101, 32, 61, 32, 34, 80, 101, 114, 115, 246, 110, 108, 105, 99, 104, 101, 223, 32, 73, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 34
]);
// encoded from 'This is some UTF 8 with BOM file.'
fixtures['some_utf8_bom.txt'] = Uint8Array.from([
239, 187, 191, 84, 104, 105, 115, 32, 105, 115, 32, 115, 111, 109, 101, 32, 85, 84, 70, 32, 56, 32, 119, 105, 116, 104, 32, 66, 79, 77, 32, 102, 105, 108, 101, 46
]);
// encoded from 'This is some UTF 16 with BOM file.'
fixtures['some.utf16le'] = Uint8Array.from([
255, 254, 84, 0, 104, 0, 105, 0, 115, 0, 32, 0, 105, 0, 115, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101, 0, 32, 0, 85, 0, 84, 0, 70, 0, 32, 0, 49, 0, 54, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 32, 0, 66, 0, 79, 0, 77, 0, 32, 0, 102, 0, 105, 0, 108, 0, 101, 0, 46, 0
]);
// encoded from 'this is utf-16 be without böm'
fixtures['utf16_be_nobom.txt'] = Uint8Array.from([
0, 116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 105, 0, 115, 0, 32, 0, 117, 0, 116, 0, 102, 0, 45, 0, 49, 0, 54, 0, 32, 0, 98, 0, 101, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 111, 0, 117, 0, 116, 0, 32, 0, 98, 0, 246, 0, 109
]);
// encoded from 'this is utf-16 le without böm'
fixtures['utf16_le_nobom.txt'] = Uint8Array.from([
116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 105, 0, 115, 0, 32, 0, 117, 0, 116, 0, 102, 0, 45, 0, 49, 0, 54, 0, 32, 0, 108, 0, 101, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 111, 0, 117, 0, 116, 0, 32, 0, 98, 0, 246, 0, 109, 0
]);
// encoded from 'Small file'
fixtures['small.txt'] = Uint8Array.from([83, 109, 97, 108, 108, 32, 102, 105, 108, 101]);
fixtures['binary.txt'] = Uint8Array.from([
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 73, 0, 0, 0, 67, 8, 2, 0, 0, 0, 95, 138, 191, 237, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, 177, 143, 11, 252, 97, 5, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 14, 195, 0, 0, 14, 195, 1, 199, 111, 168, 100, 0, 0, 0, 71, 116, 69, 88, 116, 83, 111, 117, 114, 99, 101, 0, 83, 104, 111, 116, 116, 121, 32, 118, 50, 46, 48, 46, 50, 46, 50, 49, 54, 32, 40, 67, 41, 32, 84, 104, 111, 109, 97, 115, 32, 66, 97, 117, 109, 97, 110, 110, 32, 45, 32, 104, 116, 116, 112, 58, 47, 47, 115, 104, 111, 116, 116, 121, 46, 100, 101, 118, 115, 45, 111, 110, 46, 110, 101, 116, 44, 132, 21, 213, 0, 0, 0, 84, 73, 68, 65, 84, 120, 218, 237, 207, 65, 17, 0, 0, 12, 2, 32, 211, 217, 63, 146, 37, 246, 218, 65, 3, 210, 191, 226, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 118, 100, 169, 4, 173, 8, 44, 248, 184, 40, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130
]);
fixtures['some_utf16le.css'] = Uint8Array.from([
255, 254, 47, 0, 42, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 13, 0, 10, 0, 84, 0, 104, 0, 101, 0, 32, 0, 98, 0, 97, 0, 115, 0, 101, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 116, 0, 101, 0, 109, 0, 112, 0, 108, 0, 97, 0, 116, 0, 101, 0, 32, 0, 105, 0, 115, 0, 32, 0, 35, 0, 53, 0, 99, 0, 56, 0, 55, 0, 98, 0, 50, 0, 46, 0, 32, 0, 73, 0, 102, 0, 32, 0, 121, 0, 111, 0, 117, 0, 39, 0, 100, 0, 32, 0, 108, 0, 105, 0, 107, 0, 101, 0, 13, 0, 10, 0, 116, 0, 111, 0, 32, 0, 117, 0, 115, 0, 101, 0, 32, 0, 97, 0, 32, 0, 100, 0, 105, 0, 102, 0, 102, 0, 101, 0, 114, 0, 101, 0, 110, 0, 116, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 32, 0, 115, 0, 116, 0, 97, 0, 114, 0, 116, 0, 32, 0, 98, 0, 121, 0, 32, 0, 114, 0, 101, 0, 112, 0, 108, 0, 97, 0, 99, 0, 105, 0, 110, 0, 103, 0, 32, 0, 97, 0, 108, 0, 108, 0, 32, 0, 105, 0, 110, 0, 115, 0, 116, 0, 97, 0, 110, 0, 99, 0, 101, 0, 115, 0, 32, 0, 111, 0, 102, 0, 13, 0, 10, 0, 35, 0, 53, 0, 99, 0, 56, 0, 55, 0, 98, 0, 50, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 32, 0, 121, 0, 111, 0, 117, 0, 114, 0, 32, 0, 110, 0, 101, 0, 119, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 46, 0, 13, 0, 10, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 45, 0, 42, 0, 47, 0, 13, 0, 10, 0, 98, 0, 111, 0, 100, 0, 121, 0, 13, 0, 10, 0, 123, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 98, 0, 97, 0, 99, 0, 107, 0, 103, 0, 114, 0, 111, 0, 117, 0, 110, 0, 100, 0, 45, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 58, 0, 32, 0, 35, 0, 53, 0, 99, 0, 56, 0, 55, 0, 98, 0, 50, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 102, 0, 111, 0, 110, 0, 116, 0, 45, 0, 115, 0, 105, 0, 122, 0, 101, 0, 58, 0, 32, 0, 46, 0, 55, 0, 53, 0, 101, 0, 109, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 102, 0, 111, 0, 110, 0, 116, 0, 45, 0, 102, 0, 97, 0, 109, 0, 105, 0, 108, 0, 121, 0, 58, 0, 32, 0, 83, 0, 101, 0, 103, 0, 111, 0, 101, 0, 32, 0, 85, 0, 73, 0, 44, 0, 32, 0, 86, 0, 101, 0, 114, 0, 100, 0, 97, 0, 110, 0, 97, 0, 44, 0, 32, 0, 72, 0, 101, 0, 108, 0, 118, 0, 101, 0, 116, 0, 105, 0, 99, 0, 97, 0, 44, 0, 32, 0, 83, 0, 97, 0, 110, 0, 115, 0, 45, 0, 83, 0, 101, 0, 114, 0, 105, 0, 102, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 109, 0, 97, 0, 114, 0, 103, 0, 105, 0, 110, 0, 58, 0, 32, 0, 56, 0, 112, 0, 120, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 112, 0, 97, 0, 100, 0, 100, 0, 105, 0, 110, 0, 103, 0, 58, 0, 32, 0, 48, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 58, 0, 32, 0, 35, 0, 54, 0, 57, 0, 54, 0, 57, 0, 54, 0, 57, 0, 59, 0, 13, 0, 10, 0, 125, 0, 13, 0, 10, 0, 13, 0, 10, 0, 104, 0, 49, 0, 44, 0, 32, 0, 104, 0, 50, 0, 44, 0, 32, 0, 104, 0, 51, 0, 44, 0, 32, 0, 104, 0, 52, 0, 44, 0, 32, 0, 104, 0, 53, 0, 44, 0, 32, 0, 104, 0, 54, 0, 13, 0, 10, 0, 123, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 58, 0, 32, 0, 35, 0, 48, 0, 48, 0, 48, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 102, 0, 111, 0, 110, 0, 116, 0, 45, 0, 115, 0, 105, 0, 122, 0, 101, 0, 58, 0, 32, 0, 52, 0, 48, 0, 112, 0, 120, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 109, 0, 97, 0, 114, 0, 103, 0, 105, 0, 110, 0, 58, 0, 32, 0, 48, 0, 112, 0, 120, 0, 59, 0, 13, 0, 10, 0, 125, 0, 13, 0, 10, 0, 13, 0, 10, 0, 116, 0, 101, 0, 120, 0, 116, 0, 97, 0, 114, 0, 101, 0, 97, 0, 32, 0, 13, 0, 10, 0, 123, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 102, 0, 111, 0, 110, 0, 116, 0, 45, 0, 102, 0, 97, 0, 109, 0, 105, 0, 108, 0, 121, 0, 58, 0, 32, 0, 67, 0, 111, 0, 110, 0, 115, 0, 111, 0, 108, 0, 97, 0, 115, 0, 13, 0, 10, 0, 125, 0, 13, 0, 10, 0, 13, 0, 10, 0, 35, 0, 114, 0, 101, 0, 115, 0, 117, 0, 108, 0, 116, 0, 115, 0, 32, 0, 13, 0, 10, 0, 123, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 109, 0, 97, 0, 114, 0, 103, 0, 105, 0, 110, 0, 45, 0, 116, 0, 111, 0, 112, 0, 58, 0, 32, 0, 50, 0, 101, 0, 109, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 109, 0, 97, 0, 114, 0, 103, 0, 105, 0, 110, 0, 45, 0, 108, 0, 101, 0, 102, 0, 116, 0, 58, 0, 32, 0, 50, 0, 101, 0, 109, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 99, 0, 111, 0, 108, 0, 111, 0, 114, 0, 58, 0, 32, 0, 98, 0, 108, 0, 97, 0, 99, 0, 107, 0, 59, 0, 13, 0, 10, 0, 32, 0, 32, 0, 32, 0, 32, 0, 102, 0, 111, 0, 110, 0, 116, 0, 45, 0, 115, 0, 105, 0, 122, 0, 101, 0, 58, 0, 32, 0, 109, 0, 101, 0, 100, 0, 105, 0, 117, 0, 109, 0, 59, 0, 13, 0, 10, 0, 125, 0, 13, 0, 10, 0, 13, 0, 10, 0
]);
fixtures['index.html'] = Uint8Array.from([
60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, 109, 108, 62, 10, 60, 104, 116, 109, 108, 62, 10, 60, 104, 101, 97, 100, 32, 105, 100, 61, 39, 104, 101, 97, 100, 73, 68, 39, 62, 10, 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 104, 116, 116, 112, 45, 101, 113, 117, 105, 118, 61, 34, 88, 45, 85, 65, 45, 67, 111, 109, 112, 97, 116, 105, 98, 108, 101, 34, 32, 99, 111, 110, 116, 101, 110, 116, 61, 34, 73, 69, 61, 101, 100, 103, 101, 34, 32, 47, 62, 10, 32, 32, 32, 32, 60, 116, 105, 116, 108, 101, 62, 83, 116, 114, 97, 100, 97, 32, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, 32, 32, 60, 108, 105, 110, 107, 32, 104, 114, 101, 102, 61, 34, 115, 105, 116, 101, 46, 99, 115, 115, 34, 32, 114, 101, 108, 61, 34, 115, 116, 121, 108, 101, 115, 104, 101, 101, 116, 34, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 99, 115, 115, 34, 32, 47, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 115, 114, 99, 61, 34, 106, 113, 117, 101, 114, 121, 45, 49, 46, 52, 46, 49, 46, 106, 115, 34, 62, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 115, 114, 99, 61, 34, 46, 46, 47, 99, 111, 109, 112, 105, 108, 101, 114, 47, 100, 116, 114, 101, 101, 46, 106, 115, 34, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 34, 62, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 115, 114, 99, 61, 34, 46, 46, 47, 99, 111, 109, 112, 105, 108, 101, 114, 47, 116, 121, 112, 101, 115, 99, 114, 105, 112, 116, 46, 106, 115, 34, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 34, 62, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 34, 62, 10, 10, 32, 32, 32, 32, 47, 47, 32, 67, 111, 109, 112, 105, 108, 101, 32, 115, 116, 114, 97, 100, 97, 32, 115, 111, 117, 114, 99, 101, 32, 105, 110, 116, 111, 32, 114, 101, 115, 117, 108, 116, 105, 110, 103, 32, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 10, 32, 32, 32, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 99, 111, 109, 112, 105, 108, 101, 40, 112, 114, 111, 103, 44, 32, 108, 105, 98, 84, 101, 120, 116, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 111, 117, 116, 102, 105, 108, 101, 32, 61, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 115, 111, 117, 114, 99, 101, 58, 32, 34, 34, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 114, 105, 116, 101, 58, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 40, 115, 41, 32, 123, 32, 116, 104, 105, 115, 46, 115, 111, 117, 114, 99, 101, 32, 43, 61, 32, 115, 59, 32, 125, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 114, 105, 116, 101, 76, 105, 110, 101, 58, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 40, 115, 41, 32, 123, 32, 116, 104, 105, 115, 46, 115, 111, 117, 114, 99, 101, 32, 43, 61, 32, 115, 32, 43, 32, 34, 92, 114, 34, 59, 32, 125, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 32, 61, 32, 91, 93, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 99, 111, 109, 112, 105, 108, 101, 114, 61, 110, 101, 119, 32, 84, 111, 111, 108, 115, 46, 84, 121, 112, 101, 83, 99, 114, 105, 112, 116, 67, 111, 109, 112, 105, 108, 101, 114, 40, 111, 117, 116, 102, 105, 108, 101, 44, 116, 114, 117, 101, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 114, 46, 115, 101, 116, 69, 114, 114, 111, 114, 67, 97, 108, 108, 98, 97, 99, 107, 40, 102, 117, 110, 99, 116, 105, 111, 110, 40, 115, 116, 97, 114, 116, 44, 108, 101, 110, 44, 32, 109, 101, 115, 115, 97, 103, 101, 41, 32, 123, 32, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 46, 112, 117, 115, 104, 40, 123, 115, 116, 97, 114, 116, 58, 115, 116, 97, 114, 116, 44, 32, 108, 101, 110, 58, 108, 101, 110, 44, 32, 109, 101, 115, 115, 97, 103, 101, 58, 109, 101, 115, 115, 97, 103, 101, 125, 41, 59, 32, 125, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 114, 46, 97, 100, 100, 85, 110, 105, 116, 40, 108, 105, 98, 84, 101, 120, 116, 44, 34, 108, 105, 98, 46, 116, 115, 34, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 114, 46, 97, 100, 100, 85, 110, 105, 116, 40, 112, 114, 111, 103, 44, 34, 105, 110, 112, 117, 116, 46, 116, 115, 34, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 114, 46, 116, 121, 112, 101, 67, 104, 101, 99, 107, 40, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 114, 46, 101, 109, 105, 116, 40, 41, 59, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 105, 102, 40, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 46, 108, 101, 110, 103, 116, 104, 32, 62, 32, 48, 32, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 47, 47, 116, 104, 114, 111, 119, 32, 110, 101, 119, 32, 69, 114, 114, 111, 114, 40, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 9, 119, 104, 105, 108, 101, 40, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 91, 48, 93, 32, 61, 61, 32, 39, 47, 39, 32, 38, 38, 32, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 91, 49, 93, 32, 61, 61, 32, 39, 47, 39, 32, 38, 38, 32, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 91, 50, 93, 32, 61, 61, 32, 39, 32, 39, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 32, 61, 32, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 46, 115, 108, 105, 99, 101, 40, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 46, 105, 110, 100, 101, 120, 79, 102, 40, 39, 92, 114, 39, 41, 43, 49, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 101, 114, 114, 111, 114, 80, 114, 101, 102, 105, 120, 32, 61, 32, 34, 34, 59, 10, 9, 102, 111, 114, 40, 118, 97, 114, 32, 105, 32, 61, 32, 48, 59, 105, 60, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 46, 108, 101, 110, 103, 116, 104, 59, 105, 43, 43, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 101, 114, 114, 111, 114, 80, 114, 101, 102, 105, 120, 32, 43, 61, 32, 34, 47, 47, 32, 69, 114, 114, 111, 114, 58, 32, 40, 34, 32, 43, 32, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 91, 105, 93, 46, 115, 116, 97, 114, 116, 32, 43, 32, 34, 44, 34, 32, 43, 32, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 91, 105, 93, 46, 108, 101, 110, 32, 43, 32, 34, 41, 32, 34, 32, 43, 32, 112, 97, 114, 115, 101, 69, 114, 114, 111, 114, 115, 91, 105, 93, 46, 109, 101, 115, 115, 97, 103, 101, 32, 43, 32, 34, 92, 114, 34, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 114, 101, 116, 117, 114, 110, 32, 101, 114, 114, 111, 114, 80, 114, 101, 102, 105, 120, 32, 43, 32, 111, 117, 116, 102, 105, 108, 101, 46, 115, 111, 117, 114, 99, 101, 59, 10, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 116, 121, 112, 101, 61, 34, 116, 101, 120, 116, 47, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 34, 62, 10, 9, 10, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 108, 105, 98, 84, 101, 120, 116, 32, 61, 32, 34, 34, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 36, 46, 103, 101, 116, 40, 34, 46, 46, 47, 99, 111, 109, 112, 105, 108, 101, 114, 47, 108, 105, 98, 46, 116, 115, 34, 44, 32, 102, 117, 110, 99, 116, 105, 111, 110, 40, 110, 101, 119, 76, 105, 98, 84, 101, 120, 116, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 108, 105, 98, 84, 101, 120, 116, 32, 61, 32, 110, 101, 119, 76, 105, 98, 84, 101, 120, 116, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 41, 59, 9, 10, 32, 32, 32, 32, 32, 32, 32, 32, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 47, 32, 101, 120, 101, 99, 117, 116, 101, 32, 116, 104, 101, 32, 106, 97, 118, 97, 115, 99, 114, 105, 112, 116, 32, 105, 110, 32, 116, 104, 101, 32, 99, 111, 109, 112, 105, 108, 101, 100, 79, 117, 116, 112, 117, 116, 32, 112, 97, 110, 101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 101, 120, 101, 99, 117, 116, 101, 40, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 99, 111, 109, 112, 105, 108, 97, 116, 105, 111, 110, 39, 41, 46, 116, 101, 120, 116, 40, 34, 82, 117, 110, 110, 105, 110, 103, 46, 46, 46, 34, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 116, 120, 116, 32, 61, 32, 36, 40, 39, 35, 99, 111, 109, 112, 105, 108, 101, 100, 79, 117, 116, 112, 117, 116, 39, 41, 46, 118, 97, 108, 40, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 114, 101, 115, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 116, 114, 121, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 114, 101, 116, 32, 61, 32, 101, 118, 97, 108, 40, 116, 120, 116, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 114, 101, 115, 32, 61, 32, 34, 82, 97, 110, 32, 115, 117, 99, 99, 101, 115, 115, 102, 117, 108, 108, 121, 33, 34, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 32, 99, 97, 116, 99, 104, 40, 101, 41, 32, 123, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 114, 101, 115, 32, 61, 32, 34, 69, 120, 99, 101, 112, 116, 105, 111, 110, 32, 116, 104, 114, 111, 119, 110, 58, 32, 34, 32, 43, 32, 101, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 99, 111, 109, 112, 105, 108, 97, 116, 105, 111, 110, 39, 41, 46, 116, 101, 120, 116, 40, 83, 116, 114, 105, 110, 103, 40, 114, 101, 115, 41, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 47, 32, 114, 101, 99, 111, 109, 112, 105, 108, 101, 32, 116, 104, 101, 32, 115, 116, 114, 97, 100, 97, 83, 114, 99, 32, 97, 110, 100, 32, 112, 111, 112, 117, 108, 97, 116, 101, 32, 116, 104, 101, 32, 99, 111, 109, 112, 105, 108, 101, 100, 79, 117, 116, 112, 117, 116, 32, 112, 97, 110, 101, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 115, 114, 99, 85, 112, 100, 97, 116, 101, 100, 40, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 110, 101, 119, 84, 101, 120, 116, 32, 61, 32, 36, 40, 39, 35, 115, 116, 114, 97, 100, 97, 83, 114, 99, 39, 41, 46, 118, 97, 108, 40, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 99, 111, 109, 112, 105, 108, 101, 100, 83, 111, 117, 114, 99, 101, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 116, 114, 121, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 100, 83, 111, 117, 114, 99, 101, 32, 61, 32, 99, 111, 109, 112, 105, 108, 101, 40, 110, 101, 119, 84, 101, 120, 116, 44, 32, 108, 105, 98, 84, 101, 120, 116, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 32, 99, 97, 116, 99, 104, 32, 40, 101, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 100, 83, 111, 117, 114, 99, 101, 32, 61, 32, 34, 47, 47, 80, 97, 114, 115, 101, 32, 101, 114, 114, 111, 114, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 102, 111, 114, 40, 118, 97, 114, 32, 105, 32, 105, 110, 32, 101, 41, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 109, 112, 105, 108, 101, 100, 83, 111, 117, 114, 99, 101, 32, 43, 61, 32, 34, 92, 114, 47, 47, 32, 34, 32, 43, 32, 101, 91, 105, 93, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 99, 111, 109, 112, 105, 108, 101, 100, 79, 117, 116, 112, 117, 116, 39, 41, 46, 118, 97, 108, 40, 99, 111, 109, 112, 105, 108, 101, 100, 83, 111, 117, 114, 99, 101, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 47, 32, 80, 111, 112, 117, 108, 97, 116, 101, 32, 116, 104, 101, 32, 115, 116, 114, 97, 100, 97, 83, 114, 99, 32, 112, 97, 110, 101, 32, 119, 105, 116, 104, 32, 111, 110, 101, 32, 111, 102, 32, 116, 104, 101, 32, 98, 117, 105, 108, 116, 32, 105, 110, 32, 115, 97, 109, 112, 108, 101, 115, 10, 32, 32, 32, 32, 32, 32, 32, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 101, 120, 97, 109, 112, 108, 101, 83, 101, 108, 101, 99, 116, 105, 111, 110, 67, 104, 97, 110, 103, 101, 100, 40, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 101, 120, 97, 109, 112, 108, 101, 115, 32, 61, 32, 100, 111, 99, 117, 109, 101, 110, 116, 46, 103, 101, 116, 69, 108, 101, 109, 101, 110, 116, 66, 121, 73, 100, 40, 39, 101, 120, 97, 109, 112, 108, 101, 115, 39, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 115, 101, 108, 101, 99, 116, 101, 100, 69, 120, 97, 109, 112, 108, 101, 32, 61, 32, 101, 120, 97, 109, 112, 108, 101, 115, 46, 111, 112, 116, 105, 111, 110, 115, 91, 101, 120, 97, 109, 112, 108, 101, 115, 46, 115, 101, 108, 101, 99, 116, 101, 100, 73, 110, 100, 101, 120, 93, 46, 118, 97, 108, 117, 101, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 105, 102, 32, 40, 115, 101, 108, 101, 99, 116, 101, 100, 69, 120, 97, 109, 112, 108, 101, 32, 33, 61, 32, 34, 34, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 36, 46, 103, 101, 116, 40, 39, 101, 120, 97, 109, 112, 108, 101, 115, 47, 39, 32, 43, 32, 115, 101, 108, 101, 99, 116, 101, 100, 69, 120, 97, 109, 112, 108, 101, 44, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 40, 115, 114, 99, 84, 101, 120, 116, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 115, 116, 114, 97, 100, 97, 83, 114, 99, 39, 41, 46, 118, 97, 108, 40, 115, 114, 99, 84, 101, 120, 116, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 115, 101, 116, 84, 105, 109, 101, 111, 117, 116, 40, 115, 114, 99, 85, 112, 100, 97, 116, 101, 100, 44, 49, 48, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 44, 32, 102, 117, 110, 99, 116, 105, 111, 110, 32, 40, 101, 114, 114, 41, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99, 111, 110, 115, 111, 108, 101, 46, 108, 111, 103, 40, 101, 114, 114, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 32, 32, 32, 32, 125, 10, 10, 32, 32, 32, 32, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 60, 47, 104, 101, 97, 100, 62, 10, 60, 98, 111, 100, 121, 62, 10, 32, 32, 32, 32, 60, 104, 49, 62, 84, 121, 112, 101, 83, 99, 114, 105, 112, 116, 60, 47, 104, 49, 62, 10, 32, 32, 32, 32, 60, 98, 114, 32, 47, 62, 10, 32, 32, 32, 32, 60, 115, 101, 108, 101, 99, 116, 32, 105, 100, 61, 34, 101, 120, 97, 109, 112, 108, 101, 115, 34, 32, 111, 110, 99, 104, 97, 110, 103, 101, 61, 39, 101, 120, 97, 109, 112, 108, 101, 83, 101, 108, 101, 99, 116, 105, 111, 110, 67, 104, 97, 110, 103, 101, 100, 40, 41, 39, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 111, 112, 116, 105, 111, 110, 32, 118, 97, 108, 117, 101, 61, 34, 34, 62, 83, 101, 108, 101, 99, 116, 46, 46, 46, 60, 47, 111, 112, 116, 105, 111, 110, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 111, 112, 116, 105, 111, 110, 32, 118, 97, 108, 117, 101, 61, 34, 115, 109, 97, 108, 108, 46, 116, 115, 34, 62, 83, 109, 97, 108, 108, 60, 47, 111, 112, 116, 105, 111, 110, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 111, 112, 116, 105, 111, 110, 32, 118, 97, 108, 117, 101, 61, 34, 101, 109, 112, 108, 111, 121, 101, 101, 46, 116, 115, 34, 62, 69, 109, 112, 108, 111, 121, 101, 101, 115, 60, 47, 111, 112, 116, 105, 111, 110, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 111, 112, 116, 105, 111, 110, 32, 118, 97, 108, 117, 101, 61, 34, 99, 111, 110, 119, 97, 121, 46, 116, 115, 34, 62, 67, 111, 110, 119, 97, 121, 32, 71, 97, 109, 101, 32, 111, 102, 32, 76, 105, 102, 101, 60, 47, 111, 112, 116, 105, 111, 110, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 111, 112, 116, 105, 111, 110, 32, 118, 97, 108, 117, 101, 61, 34, 116, 121, 112, 101, 115, 99, 114, 105, 112, 116, 46, 116, 115, 34, 62, 84, 121, 112, 101, 83, 99, 114, 105, 112, 116, 32, 67, 111, 109, 112, 105, 108, 101, 114, 60, 47, 111, 112, 116, 105, 111, 110, 62, 10, 32, 32, 32, 32, 60, 47, 115, 101, 108, 101, 99, 116, 62, 10, 10, 32, 32, 32, 32, 60, 100, 105, 118, 62, 10, 32, 32, 32, 32, 32, 32, 32, 32, 60, 116, 101, 120, 116, 97, 114, 101, 97, 32, 105, 100, 61, 39, 115, 116, 114, 97, 100, 97, 83, 114, 99, 39, 32, 114, 111, 119, 115, 61, 39, 52, 48, 39, 32, 99, 111, 108, 115, 61, 39, 56, 48, 39, 32, 111, 110, 99, 104, 97, 110, 103, 101, 61, 39, 115, 114, 99, 85, 112, 100, 97, 116, 101, 100, 40, 41, 39, 32, 111, 110, 107, 101, 121, 117, 112, 61, 39, 115, 114, 99, 85, 112, 100, 97, 116, 101, 100, 40, 41, 39, 32, 115, 112, 101, 108, 108, 99, 104, 101, 99, 107, 61, 34, 102, 97, 108, 115, 101, 34, 62, 10, 47, 47, 84, 121, 112, 101, 32, 121, 111, 117, 114, 32, 84, 121, 112, 101, 83, 99, 114, 105, 112, 116, 32, 104, 101, 114, 101, 46, 46, 46, 10, 32, 32, 32, 32, 32, 32, 60, 47, 116, 101, 120, 116, 97, 114, 101, 97, 62, 10, 32, 32, 32, 32, 32, 32, 60, 116, 101, 120, 116, 97, 114, 101, 97, 32, 105, 100, 61, 39, 99, 111, 109, 112, 105, 108, 101, 100, 79, 117, 116, 112, 117, 116, 39, 32, 114, 111, 119, 115, 61, 39, 52, 48, 39, 32, 99, 111, 108, 115, 61, 39, 56, 48, 39, 32, 115, 112, 101, 108, 108, 99, 104, 101, 99, 107, 61, 34, 102, 97, 108, 115, 101, 34, 62, 10, 47, 47, 67, 111, 109, 112, 105, 108, 101, 100, 32, 99, 111, 100, 101, 32, 119, 105, 108, 108, 32, 115, 104, 111, 119, 32, 117, 112, 32, 104, 101, 114, 101, 46, 46, 46, 10, 32, 32, 32, 32, 32, 32, 60, 47, 116, 101, 120, 116, 97, 114, 101, 97, 62, 10, 32, 32, 32, 32, 32, 32, 60, 98, 114, 32, 47, 62, 10, 32, 32, 32, 32, 32, 32, 60, 98, 117, 116, 116, 111, 110, 32, 111, 110, 99, 108, 105, 99, 107, 61, 39, 101, 120, 101, 99, 117, 116, 101, 40, 41, 39, 47, 62, 82, 117, 110, 60, 47, 98, 117, 116, 116, 111, 110, 62, 32, 10, 32, 32, 32, 32, 32, 32, 60, 100, 105, 118, 32, 105, 100, 61, 39, 99, 111, 109, 112, 105, 108, 97, 116, 105, 111, 110, 39, 62, 80, 114, 101, 115, 115, 32, 39, 114, 117, 110, 39, 32, 116, 111, 32, 101, 120, 101, 99, 117, 116, 101, 32, 99, 111, 100, 101, 46, 46, 46, 60, 47, 100, 105, 118, 62, 10, 32, 32, 32, 32, 32, 32, 60, 100, 105, 118, 32, 105, 100, 61, 39, 114, 101, 115, 117, 108, 116, 115, 39, 62, 46, 46, 46, 119, 114, 105, 116, 101, 32, 121, 111, 117, 114, 32, 114, 101, 115, 117, 108, 116, 115, 32, 105, 110, 116, 111, 32, 35, 114, 101, 115, 117, 108, 116, 115, 46, 46, 46, 60, 47, 100, 105, 118, 62, 10, 32, 32, 32, 32, 60, 47, 100, 105, 118, 62, 10, 32, 32, 32, 32, 60, 100, 105, 118, 32, 105, 100, 61, 39, 98, 111, 100, 39, 32, 115, 116, 121, 108, 101, 61, 39, 100, 105, 115, 112, 108, 97, 121, 58, 110, 111, 110, 101, 39, 62, 60, 47, 100, 105, 118, 62, 10, 60, 47, 98, 111, 100, 121, 62, 10, 60, 47, 104, 116, 109, 108, 62, 10
]);
const lorem = getLorem();
// needle encoded from 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя'
fixtures['lorem_cp866.txt'] = getTestData(
Uint8Array.from([...range(128, 175 + 1), ...range(224, 239 + 1)])
);
// needle encoded from öäüß
fixtures['lorem_cp1252.txt'] = getTestData(Uint8Array.from([246, 228, 252, 223]));
// needle encoded from '中文abc'
fixtures['lorem_big5.txt'] = getTestData(Uint8Array.from([164, 164, 164, 229, 97, 98, 99]));
// needle encoded from '中文abc'
fixtures['lorem_shiftjis.txt'] = getTestData(Uint8Array.from([146, 134, 149, 182, 97, 98, 99]));
// needle encoded from '中国abc'
fixtures['lorem_gbk.txt'] = getTestData(Uint8Array.from([214, 208, 185, 250, 97, 98, 99]));
// needle encoded from öäüß
fixtures['lorem.txt'] = getTestData(Uint8Array.from([246, 228, 252, 223]));
fixtures['lorem_utf8bom.txt'] = VSBuffer.concat([
VSBuffer.wrap(Uint8Array.from(UTF8_BOM)),
VSBuffer.wrap(getTestData(Uint8Array.from([195, 182, 195, 164, 195, 188, 195, 159]))),
]).buffer;
fixtures['lorem_utf16be.txt'] =
Uint8Array.from(
fixtures['lorem.txt'].reduce((acc, byte, i) => {
acc[2 * i] = 0;
acc[2 * i + 1] = byte;
return acc;
}, [] as number[])
);
fixtures['lorem_utf16le.txt'] =
Uint8Array.from(
fixtures['lorem.txt'].reduce((acc, byte, i) => {
acc[2 * i] = byte;
acc[2 * i + 1] = 0;
return acc;
}, [] as number[])
);
function getTestData(needle: Uint8Array): Uint8Array {
const needleBuffer = VSBuffer.wrap(needle);
return VSBuffer
.concat(
[
needleBuffer,
VSBuffer.fromString(' '),
lorem.head,
needleBuffer,
VSBuffer.fromString(' '),
lorem.tail,
]
)
.buffer;
}
function getLorem() {
return {
head: VSBuffer.fromString(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vulputate, ipsum quis interdum fermentum, lorem sem fermentum eros, vitae auctor neque lacus in nisi. Suspendisse potenti. Maecenas et scelerisque elit, in tincidunt quam. Sed eu tincidunt quam. Nullam justo ex, imperdiet a imperdiet et, fermentum sit amet eros. Aenean quis tempus sem. Pellentesque accumsan magna mi, ut mollis velit sagittis id. Etiam quis ipsum orci. Fusce purus ante, accumsan a lobortis at, venenatis eu nisl. Praesent ornare sed ante placerat accumsan. Suspendisse tempus dignissim fermentum. Nunc a leo ac lacus sodales iaculis eu vitae mi. In feugiat ante at massa finibus cursus. Suspendisse posuere fringilla ornare. Mauris elementum ac quam id convallis. Vestibulum non elit quis urna volutpat aliquam a eu lacus.
Aliquam vestibulum imperdiet neque, suscipit aliquam elit ultrices bibendum. Suspendisse ultrices pulvinar cursus. Morbi risus nisi, cursus consequat rutrum vitae, molestie sed dui. Fusce posuere, augue quis dignissim aliquam, nisi ipsum porttitor ante, quis fringilla nisl turpis ac nisi. Nulla varius enim eget lorem vehicula gravida. Donec finibus malesuada leo nec semper. Proin ac enim eros. Vivamus non tincidunt nisi, vel tristique lorem.
Nunc consequat ex id eros dignissim, id rutrum risus laoreet. Sed euismod non erat eu ultricies. Etiam vehicula gravida lacus ut porta. Vestibulum eu eros quis nunc aliquet luctus. Cras quis semper ligula. Nullam gravida vehicula quam sed porta. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In porta cursus vulputate. Quisque porta a nisi eget cursus. Aliquam risus leo, luctus ac magna in, efficitur cursus magna. In condimentum non mi id semper. Donec interdum ante eget commodo maximus.
Vivamus sit amet vestibulum lectus. Fusce tincidunt mi sapien, dictum sollicitudin diam vulputate in. Integer fringilla consequat mollis. Cras aliquet consequat felis eget feugiat. Nunc tempor cursus arcu, vitae ornare nunc varius et. Vestibulum et tortor vel ante viverra porttitor. Nam at tortor ullamcorper, facilisis augue quis, tristique erat. Aenean ut euismod nibh. Quisque eu tincidunt est, nec euismod eros.
Proin vehicula nibh non viverra egestas. Phasellus sem dolor, ultricies ac sagittis tristique, lacinia a purus. Vestibulum in ante eros. Pellentesque lacus nulla, tristique vitae interdum vel, malesuada ac diam. Aenean bibendum posuere turpis in accumsan. Ut est nulla, ullamcorper quis turpis at, viverra sagittis mauris. Sed in interdum purus. Praesent scelerisque nibh eget sem euismod, ut imperdiet mi venenatis. Vivamus pulvinar orci sed dapibus auctor. Nulla facilisi. Vestibulum tincidunt erat nec porttitor egestas. Mauris quis risus ante. Nulla facilisi.
Aliquam ullamcorper ornare lobortis. Phasellus quis sem et ipsum mollis malesuada sed in ex. Ut aliquam ex eget metus finibus maximus. Proin suscipit mauris eu nibh lacinia, quis feugiat dui dapibus. Nam sed libero est. Aenean vulputate orci sit amet diam faucibus, eu sagittis sapien volutpat. Nam imperdiet felis turpis, at pretium odio pulvinar in. Sed vestibulum id eros nec ultricies. Sed quis aliquam tortor, vitae ullamcorper tellus. Donec egestas laoreet eros, id suscipit est rutrum nec. Sed auctor nulla eget metus aliquam, ut condimentum enim elementum.
Aliquam suscipit non turpis sit amet bibendum. Fusce velit ligula, euismod et maximus at, luctus sed neque. Quisque pretium, nisl at ullamcorper finibus, lectus leo mattis sapien, vel euismod mauris diam ullamcorper ex. Nulla ut risus finibus, lacinia ligula at, auctor erat. Mauris consectetur sagittis ligula vel dapibus. Nullam libero libero, lobortis aliquam libero vel, venenatis ultricies leo. Duis porttitor, nibh congue fermentum posuere, erat libero pulvinar tortor, a pellentesque nunc ipsum vel sem. Nullam volutpat, eros sit amet facilisis consectetur, ipsum est vehicula massa, non vestibulum neque elit in mauris. Nunc hendrerit ipsum non enim bibendum, vitae rhoncus mi egestas. Etiam ullamcorper massa vel nisl sagittis, nec bibendum arcu malesuada. Aenean aliquet turpis justo, a consectetur arcu mollis convallis. Etiam tellus ipsum, ultricies vitae lorem et, ornare facilisis orci. Praesent fringilla justo urna, vel mollis neque pulvinar vestibulum.
Donec non iaculis erat. Aliquam et mi sed nunc pulvinar ultricies in ut ipsum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent feugiat lacus ac dignissim semper. Phasellus vitae quam nisi. Morbi vel diam ultricies risus lobortis ornare. Fusce maximus et ligula quis iaculis. Sed congue ex eget felis convallis, sit amet hendrerit elit tempor. Donec vehicula blandit ante eget commodo. Vestibulum eleifend diam at feugiat euismod. Etiam magna tellus, dignissim eget fermentum vel, vestibulum vitae mauris. Nam accumsan et erat id sagittis. Donec lacinia, odio ut ornare ultricies, dolor velit accumsan tortor, non finibus erat tellus quis ligula. Nunc quis metus in leo volutpat ornare vulputate eu nisl.
Donec quis viverra ex. Nullam id feugiat mauris, eu fringilla nulla. Vestibulum id maximus elit. Cras elementum elit sed felis lobortis, eget sagittis nisi hendrerit. Vivamus vitae elit neque. Donec vulputate lacus ut libero ultrices accumsan. Vivamus accumsan nulla orci, in dignissim est laoreet sagittis. Proin at commodo velit. Curabitur in velit felis. Aliquam erat volutpat. Sed consequat, nulla et cursus sodales, nisi lacus mattis risus, quis eleifend erat ex nec turpis. Sed suscipit ultrices lorem in hendrerit.
Morbi vitae lacus nec libero ornare tempus eu et diam. Suspendisse magna ipsum, fermentum vel odio quis, molestie aliquam urna. Fusce mollis turpis a eros accumsan porttitor. Pellentesque rhoncus dolor sit amet magna rutrum, et dapibus justo tempor. Sed purus nisi, maximus vitae fringilla eu, molestie nec urna. Fusce malesuada finibus pretium. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec sed aliquet eros. Pellentesque luctus diam ante, eget euismod nisl aliquet eu. Sed accumsan elit purus, tempor varius ligula tempus nec. Curabitur ornare leo suscipit suscipit fermentum. Morbi eget nulla est. Maecenas faucibus interdum tristique.
Etiam ut elit eros. Nulla pharetra suscipit molestie. Nulla facilisis bibendum nisl non molestie. Curabitur turpis lectus, facilisis vel diam non, vulputate ultrices mauris. Aenean placerat aliquam convallis. Suspendisse sed scelerisque tellus. Vivamus lacinia neque eget risus cursus suscipit. Proin consequat dolor vel neque tempor, eu aliquam sem scelerisque. Duis non eros a purus malesuada pharetra non et nulla. Suspendisse potenti. Mauris libero eros, finibus vel nulla id, sagittis dapibus ante. Proin iaculis sed nunc et cursus.
Quisque accumsan lorem sit amet lorem aliquet euismod. Curabitur fermentum rutrum posuere. Etiam ultricies, sem id pellentesque suscipit, urna magna lacinia eros, quis efficitur risus nisl at lacus. Nulla quis lacus tortor. Mauris placerat ex in dolor tincidunt, vel aliquet nisi pretium. Cras iaculis risus vitae pellentesque aliquet. Quisque a enim imperdiet, ullamcorper arcu vitae, rutrum risus. Nullam consectetur libero at felis fringilla, nec congue nibh dignissim. Nam et lobortis felis, eu pellentesque ligula. Aenean facilisis, ligula non imperdiet maximus, massa orci gravida sapien, at sagittis lacus nisl in lacus. Nulla quis mauris luctus, scelerisque felis consequat, tempus risus. Fusce auctor nisl non nulla luctus molestie. Maecenas sapien nisl, auctor non dolor et, iaculis scelerisque lorem. Suspendisse egestas enim aliquet, accumsan mauris nec, posuere quam. Nulla iaculis dui dui, sit amet vestibulum erat ultricies ac.
Cras eget dolor erat. Proin at nisl ut leo consectetur ultricies vel ut arcu. Nulla in felis malesuada, ullamcorper tortor et, convallis massa. Nunc urna justo, ornare in nibh vitae, hendrerit condimentum libero. Etiam vitae libero in purus venenatis fringilla. Nullam velit nulla, consequat ut turpis non, egestas hendrerit nibh. Duis tortor turpis, interdum non ante ac, cursus accumsan lectus. Cras pharetra bibendum augue quis dictum. Sed euismod vestibulum justo. Proin porta lobortis purus. Duis venenatis diam tortor, sit amet condimentum eros rhoncus a. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc at magna nec diam lobortis efficitur sit amet ut lacus. Nulla quis orci tortor. Pellentesque tempus velit a odio finibus porta.
Proin feugiat mauris a tellus scelerisque convallis. Maecenas libero magna, blandit nec ultrices id, congue vel mi. Aliquam lacinia, quam vel condimentum convallis, tortor turpis aliquam odio, sed blandit libero lacus et eros. In eleifend iaculis magna ac finibus. Praesent auctor facilisis tellus in congue. Sed molestie lobortis dictum. Nam quis dignissim augue, vel euismod lorem. Curabitur posuere dapibus luctus. Donec ultricies dictum lectus, quis blandit arcu commodo ac. Aenean tincidunt ligula in nunc imperdiet dignissim. Curabitur egestas sollicitudin sapien ut semper. Aenean nec dignissim lacus.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec aliquam dictum vehicula. Donec tortor est, volutpat non nisi nec, varius gravida ex. Nunc vel tristique nunc, vitae mattis nisi. Nunc nec luctus ex, vitae tincidunt lectus. In hac habitasse platea dictumst. Curabitur lobortis ex eget tincidunt tempor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut a vehicula mi.
Fusce eu libero finibus, interdum nulla a, placerat neque. Cras bibendum tempor libero nec feugiat. Cras ut sodales eros. Proin viverra, massa sit amet viverra egestas, neque nisl porta ex, sit amet hendrerit libero ligula vel urna. Mauris suscipit lacus id justo rhoncus suscipit. Etiam vel libero tellus. Maecenas non diam molestie, condimentum tellus a, bibendum enim. Mauris aliquet imperdiet tellus, eget sagittis dolor. Sed blandit in neque et luctus. Cras elementum sagittis nunc, vel mollis lorem euismod et. Donec posuere at lacus eget suscipit.
Nulla nunc mi, pretium non massa vel, tempor semper magna. Nunc a leo pulvinar, tincidunt nunc at, dignissim mi. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut viverra nulla a nisl finibus, at hendrerit ligula ullamcorper. Donec a lorem semper, tempor magna et, lobortis libero. Mauris id sapien leo. Donec dignissim, quam vitae porttitor dignissim, quam justo mattis dui, vel consequat odio elit quis orci. Etiam nec pretium neque, sit amet pretium orci. Duis ac tortor venenatis, feugiat purus non, feugiat nunc. Proin scelerisque nisl in turpis aliquam vulputate.
Praesent sed est semper, fringilla lorem vitae, tincidunt nibh. Cras eros metus, auctor at mauris sit amet, sodales semper orci. Nunc a ornare ex. Curabitur bibendum arcu congue urna vulputate egestas. Vestibulum finibus id risus et accumsan. Aenean ut volutpat tellus. Aenean tincidunt malesuada urna sit amet vestibulum. Mauris vel tellus dictum, varius lacus quis, dictum arcu.
Aenean quis metus eu erat feugiat cursus vel at ligula. Proin dapibus sodales urna, id euismod lectus tempus id. Pellentesque ex ligula, convallis et erat vel, vulputate condimentum nisl. Pellentesque pharetra nulla quis massa eleifend hendrerit. Praesent sed massa ipsum. Maecenas vehicula dolor massa, id sodales urna faucibus et. Mauris ac quam non massa tincidunt feugiat et at lacus. Fusce libero massa, vulputate vel scelerisque non, mollis in leo. Ut sit amet ultricies odio. Suspendisse in sapien viverra, facilisis purus ut, pretium libero.
Vivamus tristique pharetra molestie. Nam a volutpat purus. Praesent consequat gravida nisi, ac blandit nisi suscipit ut. Quisque posuere, ligula a ultrices laoreet, ligula nunc vulputate libero, ut rutrum erat odio tincidunt justo. Sed vitae leo at leo fringilla bibendum. Vestibulum ut augue nec dolor auctor accumsan. Praesent laoreet id eros pulvinar commodo. Suspendisse potenti. Ut pharetra, mauris vitae blandit fringilla, odio ante tincidunt lorem, sit amet tempor metus diam ut turpis.
Praesent quis egestas arcu. Nullam at porta arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi vulputate ligula malesuada ligula luctus, vulputate tempus erat bibendum. Nunc ullamcorper non lectus at euismod. Etiam nibh felis, tincidunt a metus vel, pellentesque rhoncus neque. Etiam at diam in erat luctus interdum. Nunc vel ipsum pulvinar, sollicitudin lacus ac, tempus urna. Etiam vel lacinia sapien. Pellentesque sagittis velit vel mi efficitur iaculis. Integer euismod sit amet urna in sagittis. Cras eleifend ut nibh in facilisis. Donec et lacus vitae nunc placerat sodales. Nulla sed hendrerit ligula, at dapibus sapien.
Praesent at iaculis ex. Curabitur est purus, cursus a faucibus quis, dictum id velit. Donec dignissim fringilla viverra. Nunc mauris felis, laoreet sit amet sagittis at, vestibulum in libero. Maecenas quis orci turpis. Quisque ut nibh vitae magna mollis consequat id at mauris. Aliquam eu odio eget nulla bibendum sodales. Quisque vel orci eleifend nisi pretium lacinia. Suspendisse eget risus eget mi volutpat molestie eget quis lacus. Duis nisi libero, tincidunt nec nulla id, faucibus cursus felis.
Donec tempor eget risus pellentesque molestie. Phasellus porta neque vel arcu egestas, nec blandit velit fringilla. Nullam porta faucibus justo vitae laoreet. Pellentesque viverra id nunc eu varius. Nulla pulvinar lobortis iaculis. Etiam vestibulum odio nec velit tristique, a tristique nisi mattis. In sed fringilla orci, vitae efficitur odio. Quisque dui odio, ornare eget velit at, lacinia consequat libero. Quisque lectus nulla, aliquet eu leo in, porta rutrum diam. Donec nec mattis neque. Nam rutrum, odio ac eleifend bibendum, dolor arcu rutrum neque, eget porta elit tellus a lacus. Sed massa metus, sollicitudin et sapien eu, finibus tempus orci. Proin et sapien sit amet erat molestie interdum. In quis rutrum velit, faucibus ultrices tellus.
Sed sagittis sed justo eget tincidunt. Maecenas ut leo sagittis, feugiat magna et, viverra velit. Maecenas ex arcu, feugiat at consequat vitae, auctor eu massa. Integer egestas, enim vitae maximus convallis, est lectus pretium mauris, ac posuere lectus nisl quis quam. Aliquam tempus laoreet mi, vitae dapibus dolor varius dapibus. Suspendisse potenti. Donec sit amet purus nec libero dapibus tristique. Pellentesque viverra bibendum ligula. Donec sed felis et ex lobortis laoreet. Phasellus a fringilla libero, vitae malesuada nulla. Pellentesque blandit mattis lacus, et blandit tortor laoreet consequat. Suspendisse libero nunc, viverra sed fermentum in, accumsan egestas arcu. Proin in placerat elit. Sed interdum imperdiet malesuada. Suspendisse aliquet quis mauris eget sollicitudin.
Vivamus accumsan tellus non erat volutpat, quis dictum dolor feugiat. Praesent rutrum nunc ac est mollis cursus. Fusce semper volutpat dui ut egestas. Curabitur sit amet posuere massa. Cras tincidunt nulla et mi mollis imperdiet. Suspendisse scelerisque ex id sodales vulputate. In nunc augue, pharetra in placerat eu, mattis id tellus. Vivamus cursus efficitur vehicula. Nulla aliquet vehicula aliquet.
Sed cursus tellus sed porta pulvinar. Sed vitae nisi neque. Nullam aliquet, lorem et efficitur scelerisque, arcu diam aliquam felis, sed pulvinar lorem odio et turpis. Praesent convallis pulvinar turpis eu iaculis. Aliquam nec gravida mi. Curabitur eu nibh tempor, blandit justo in, ultrices felis. Fusce placerat metus non mi sagittis rutrum. Morbi sed dui fringilla, sagittis mauris eget, imperdiet nunc. Phasellus hendrerit sem elit, id hendrerit libero auctor sit amet. Integer sodales elit sit amet consequat cursus.
Nam semper est eget nunc mollis, in pellentesque lectus fringilla. In finibus vel diam id semper. Nunc mattis quis erat eu consectetur. In hac habitasse platea dictumst. Nullam et ipsum vestibulum ex pulvinar ultricies sit amet id velit. Aenean suscipit mi tortor, a lobortis magna viverra non. Nulla condimentum aliquet ante et ullamcorper. Pellentesque porttitor arcu a posuere tempus. Aenean lacus quam, imperdiet eu justo vitae, pretium efficitur ex. Duis id purus id magna rhoncus ultrices id eu risus. Nunc dignissim et libero id dictum.
Quisque a tincidunt neque. Phasellus commodo mi sit amet tempor fringilla. Ut rhoncus, neque non porttitor elementum, libero nulla egestas augue, sed fringilla sapien felis ac velit. Phasellus viverra rhoncus mollis. Nam ullamcorper leo vel erat laoreet luctus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus semper a metus a cursus. Nulla sed orci egestas, efficitur purus ac, malesuada tellus. Aenean rutrum velit at tellus fermentum mollis. Aliquam eleifend euismod metus.
In hac habitasse platea dictumst. Vestibulum volutpat neque vitae porttitor laoreet. Nam at tellus consequat, sodales quam in, pulvinar arcu. Maecenas varius convallis diam, ac lobortis tellus pellentesque quis. Maecenas eget augue massa. Nullam volutpat nibh ac justo rhoncus, ut iaculis tellus rutrum. Fusce efficitur efficitur libero quis condimentum. Curabitur congue neque non tincidunt tristique. Fusce eget tempor ex, at pellentesque odio. Praesent luctus dictum vestibulum. Etiam non orci nunc. Vivamus vitae laoreet purus, a lobortis velit. Curabitur tincidunt purus ac lectus elementum pellentesque. Quisque sed tincidunt est.
Sed vel ultrices massa, vitae ultricies justo. Cras finibus mauris nec lacus tempus dignissim. Cras faucibus maximus velit, eget faucibus orci luctus vehicula. Nulla massa nunc, porta ac consequat eget, rhoncus non tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce sed maximus metus, vel imperdiet ipsum. Ut scelerisque lectus at blandit porttitor. Ut vulputate nunc pharetra, aliquet sapien ac, sollicitudin sapien. Aenean eget ante lorem. Nam accumsan venenatis tellus id dignissim.
Curabitur fringilla, magna non maximus dapibus, nulla sapien vestibulum lectus, sit amet semper dolor neque vitae nisl. Nunc ultrices vehicula augue sed iaculis. Maecenas nec diam mollis, suscipit orci et, vestibulum ante. Pellentesque eu nisl tortor. Nunc eleifend, lacus quis volutpat volutpat, nisi mi molestie sem, quis mollis ipsum libero a tellus. Ut viverra dolor mattis convallis interdum. Sed tempus nisl at nunc scelerisque aliquet. Quisque tempor tempor lorem id feugiat. Nullam blandit lectus velit, vitae porta lacus tincidunt a. Vivamus sit amet arcu ultrices, tincidunt mi quis, viverra quam. Aenean fringilla libero elementum lorem semper, quis pulvinar eros gravida. Nullam sodales blandit mauris, sed fermentum velit fermentum sit amet. Donec malesuada mauris in augue sodales vulputate. Vestibulum gravida turpis id elit rhoncus dignissim. Integer non congue lorem, eu viverra orci.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec at dolor magna. Aliquam consectetur erat augue, id iaculis velit pharetra ac. Integer rutrum venenatis dignissim. Integer non sodales elit. Curabitur ut magna ut nibh feugiat aliquam ac ut risus. Morbi nibh quam, aliquam id placerat nec, vestibulum eget velit. Suspendisse at dignissim quam. Vivamus aliquet sem sed nisl volutpat, ut cursus orci ultrices. Aliquam ultrices lacinia enim, vitae aliquet neque.
Quisque scelerisque finibus diam in mattis. Cras cursus auctor velit. Aliquam sem leo, fermentum et maximus et, molestie a libero. Aenean justo elit, rutrum a ornare id, egestas eget enim. Aenean auctor tristique erat. Curabitur condimentum libero lacus, nec consequat orci vestibulum sed. Fusce elit ligula, blandit vitae sapien vitae, dictum ultrices risus. Nam laoreet suscipit sapien, at interdum velit faucibus sit amet. Duis quis metus egestas lectus elementum posuere non nec libero. Aliquam a dolor bibendum, facilisis nunc a, maximus diam. Vestibulum suscipit tristique magna, non dignissim turpis sodales sed. Nunc ornare, velit ac facilisis fringilla, dolor mi consectetur lorem, vitae finibus erat justo suscipit urna. Maecenas sit amet eros erat. Nunc non arcu ornare, suscipit lorem eget, sodales mauris. Aliquam tincidunt, quam nec mollis lacinia, nisi orci fermentum libero, consequat eleifend lectus quam et sapien. Vestibulum a quam urna.
Cras arcu leo, euismod ac ullamcorper at, faucibus sed massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus porttitor velit in enim interdum, non commodo metus ornare. Morbi vel lorem quis nisl luctus tristique quis vitae nisl. Suspendisse condimentum tortor enim, nec eleifend ipsum euismod et. Sed gravida quam ut tristique lacinia. Mauris eu interdum ipsum, ac ultrices odio. Nullam auctor tellus a risus porttitor vehicula. Nulla blandit euismod dictum. In pharetra, enim iaculis pulvinar interdum, dui nunc placerat nunc, sit amet pretium lectus nulla vitae quam. Phasellus quis enim sollicitudin, varius nulla id, ornare purus. Donec quam lacus, vestibulum quis nunc ac, mollis dictum nisi. Cras ut mollis elit. Maecenas ultrices ligula at risus faucibus scelerisque. Etiam vitae porttitor purus. Curabitur blandit lectus urna, ut hendrerit tortor feugiat ut.
Phasellus fringilla, sapien pellentesque commodo pharetra, ante libero aliquam tellus, ut consectetur augue libero a sapien. Maecenas blandit luctus nisl eget aliquet. Maecenas vitae porta dolor, faucibus laoreet sapien. Suspendisse lobortis, ipsum sed vehicula aliquam, elit purus scelerisque dui, rutrum consectetur diam odio et lorem. In nec lacinia metus. Donec viverra libero est, vel bibendum erat condimentum quis. Donec feugiat purus leo. In laoreet vitae felis a porttitor. Mauris ullamcorper, lacus id condimentum suscipit, neque magna pellentesque arcu, eget cursus neque tellus id metus. Curabitur volutpat ac orci vel ultricies.
Sed ut finibus erat. Sed diam purus, varius non tincidunt quis, ultrices sit amet ipsum. Donec et egestas nulla. Suspendisse placerat nisi at dui laoreet iaculis. Aliquam aliquet leo at augue faucibus molestie. Nullam lacus augue, hendrerit sed nisi eu, faucibus porta est. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam ut leo aliquet sem fermentum rutrum quis ac justo. Integer placerat aliquam nisl ut sagittis. Proin erat orci, lobortis et sem eget, eleifend fringilla augue. Mauris varius laoreet arcu, sed tincidunt felis. Pellentesque venenatis lorem odio, id pulvinar velit molestie feugiat. Donec mattis lacus sed eleifend pulvinar.
Sed condimentum ex in tincidunt hendrerit. Etiam eget risus lacinia, euismod nibh eu, pellentesque quam. Proin elit eros, convallis id mauris ac, bibendum ultrices lectus. Morbi venenatis, purus id fermentum consequat, nunc libero tincidunt ligula, non dictum ligula orci nec quam. Nulla nec ultrices lorem. Aenean maximus augue vel dictum pharetra. Etiam turpis urna, pellentesque quis malesuada eu, molestie faucibus felis.
Vestibulum pharetra augue ut quam blandit congue in nec risus. Proin eu nibh eu dui eleifend porta vitae id lectus. Proin lacus nibh, lobortis sed ligula vitae, interdum lobortis erat. Suspendisse potenti. In sollicitudin quis sapien ut aliquet. Mauris ac nulla arcu. Fusce tristique justo quis lectus mollis, eu volutpat lectus finibus. Vivamus venenatis facilisis ex ut vestibulum.
Etiam varius lobortis purus, in hendrerit elit tristique at. In tempus, augue vestibulum fermentum gravida, ligula tellus vulputate arcu, eu molestie ex sapien at purus. Vestibulum nec egestas metus. Duis pulvinar quam nec consequat interdum. Aenean non dapibus lacus. Aliquam sit amet aliquet nulla. Sed venenatis volutpat purus nec convallis. Phasellus aliquet semper sodales. Cras risus sapien, condimentum auctor urna a, pulvinar ornare nisl. Sed tincidunt felis elit, ut elementum est bibendum ac. Morbi interdum justo vel dui faucibus condimentum.
Sed convallis eu sem at tincidunt. Nullam at auctor est, et ullamcorper ipsum. Pellentesque eget ante ante. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer euismod, sapien sed dapibus ornare, nibh enim maximus lacus, lacinia placerat urna quam quis felis. Morbi accumsan id nisl ut condimentum. Donec bibendum nisi est, sed volutpat lorem rhoncus in. Vestibulum ac lacinia nunc, eget volutpat magna. Integer aliquam pharetra ipsum, id placerat nunc volutpat quis. Etiam urna diam, rhoncus sit amet varius vel, euismod vel sem. Nullam vel molestie urna. Vivamus ornare erat at venenatis euismod. Suspendisse potenti. Fusce diam justo, tincidunt vel sem at, commodo faucibus nisl. Duis gravida efficitur diam, vel sagittis erat pulvinar ut.
Quisque vel pharetra felis. Duis efficitur tortor dolor, vitae porttitor erat fermentum sed. Sed eu mi purus. Etiam dignissim tortor eu tempus molestie. Aenean pretium erat enim, in hendrerit ante hendrerit at. Sed ut risus vel nunc venenatis ultricies quis in lacus. Pellentesque vitae purus euismod, placerat risus non, ullamcorper augue. Quisque varius quam ligula, nec aliquet ex faucibus vitae. Quisque rhoncus sit amet leo tincidunt mattis. Cras id mauris eget purus pretium gravida sit amet eu augue. Aliquam dapibus odio augue, id lacinia velit pulvinar eu.
Mauris fringilla, tellus nec pharetra iaculis, neque nisi ultrices massa, et tincidunt sem dui sed mi. Curabitur erat lorem, venenatis quis tempus lacinia, tempus sit amet nunc. Aliquam at neque ac metus commodo dictum quis vitae justo. Phasellus eget lacus tempus, blandit lorem vel, rutrum est. Aenean pharetra sem ut augue lobortis dignissim. Sed rhoncus at nulla id ultrices. Cras id condimentum felis. In suscipit luctus vulputate. Donec tincidunt lacus nec enim tincidunt sollicitudin ut quis enim. Nam at libero urna. Praesent sit amet massa vitae massa ullamcorper vehicula.
Nullam bibendum augue ut turpis condimentum bibendum. Proin sit amet urna hendrerit, sodales tortor a, lobortis lectus. Integer sagittis velit turpis, et tincidunt nisi commodo eget. Duis tincidunt elit finibus accumsan cursus. Aenean dignissim scelerisque felis vel lacinia. Nunc lacinia maximus luctus. In hac habitasse platea dictumst. Vestibulum eget urna et enim tempor tempor. Nam feugiat, felis vel vestibulum tempus, orci justo viverra diam, id dapibus lorem justo in ligula.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In ac pellentesque sem. Vestibulum lacinia magna dui, eu lacinia augue placerat et. Maecenas pulvinar congue est. Pellentesque commodo dui non pulvinar scelerisque. Etiam interdum est posuere sem bibendum, ac commodo magna dictum. Cras ipsum turpis, rhoncus nec posuere vitae, laoreet a arcu. Integer ac massa sit amet enim placerat lacinia sed ultrices arcu. Suspendisse sem nibh, luctus sit amet volutpat in, pellentesque eu metus. Ut gravida neque eget mi accumsan tempus. Nam sit amet aliquet nibh.
Pellentesque a purus cursus nulla hendrerit congue quis et odio. Aenean hendrerit, leo ullamcorper sagittis hendrerit, erat dui molestie quam, sed condimentum lacus risus sed tellus. Morbi a dapibus lectus, ut feugiat ex. Phasellus pretium quam et sapien mollis, vel iaculis dui dignissim. Sed ullamcorper est turpis, a viverra lorem consectetur in. Aenean aliquet nibh non cursus rutrum. Suspendisse at tristique urna, id lobortis urna. In hac habitasse platea dictumst. Phasellus libero velit, rutrum sed tellus nec, dapibus tincidunt ligula. Quisque vel dui venenatis, consequat nisl ut, lacinia ipsum. Phasellus vitae magna pellentesque, lobortis est id, faucibus quam. Nam eleifend faucibus dui vel pellentesque.
Etiam ut est non lacus tincidunt interdum. Maecenas sed massa urna. Quisque ut nibh tortor. Pellentesque felis ipsum, tempor finibus ipsum et, euismod pretium metus. Donec sit amet est ipsum. Quisque rhoncus justo non finibus elementum. Nulla nec lectus ac tortor placerat fringilla. Phasellus ac ultrices nunc, eu efficitur nisl. Nulla rhoncus nunc vitae ante dictum tincidunt. Nunc ultrices, massa sit amet malesuada dignissim, lectus lacus consequat sapien, non eleifend metus sem in eros. Phasellus mauris ante, dictum sit amet suscipit ac, rhoncus eget nisi. Phasellus at orci mollis, imperdiet neque eget, faucibus nulla. In at purus massa. Pellentesque quis rutrum lectus.
Integer eu faucibus turpis, sit amet mollis massa. Vestibulum id nulla commodo, rutrum ipsum sed, semper ante. Phasellus condimentum orci nec nibh convallis, ac maximus orci ullamcorper. Maecenas vitae sollicitudin mi. Integer et finibus lectus, et condimentum ligula. Donec elementum tristique quam vitae dapibus. Morbi euismod ipsum in tristique ullamcorper.
Duis fermentum non enim eu auctor. Quisque lacinia nibh vehicula nibh posuere, eu volutpat turpis facilisis. Ut ac faucibus nulla. Sed eleifend quis ex et pellentesque. Vestibulum sollicitudin in libero id fringilla. Phasellus dignissim purus consequat, condimentum dui sit amet, condimentum ante. Pellentesque ac consectetur massa, quis sagittis est. Nulla maximus tristique risus accumsan convallis. Curabitur imperdiet ac lacus a ultrices. Nulla facilisi. Sed quis quam quis lectus placerat lobortis vel sed turpis. In mollis dui id neque iaculis, ut aliquet tellus malesuada. Proin at luctus odio, vel blandit sapien. Praesent dignissim tortor vehicula libero fringilla, nec ultrices erat suscipit. Maecenas scelerisque purus in dapibus fermentum.
Curabitur magna odio, mattis in tortor ut, porttitor congue est. Vestibulum mollis lacinia elementum. Fusce maximus erat vitae nunc rutrum lobortis. Integer ligula eros, auctor vel elit non, posuere luctus lacus. Maecenas quis auctor massa. Ut ipsum lacus, efficitur posuere euismod et, hendrerit efficitur est. Phasellus fringilla, quam id tincidunt pretium, nunc dui sollicitudin orci, eu dignissim nisi metus ut magna. Integer lobortis interdum dolor, non bibendum purus posuere et. Donec non lectus aliquet, pretium dolor eu, cursus massa. Sed ut dui sapien. In sed vestibulum massa. Pellentesque blandit, dui non sodales vehicula, orci metus mollis nunc, non pharetra ex tellus ac est. Mauris sagittis metus et fermentum pretium. Nulla facilisi. Quisque quis ante ut nulla placerat mattis ut quis nisi.
Sed quis nulla ligula. Quisque dignissim ligula urna, sed aliquam purus semper at. Suspendisse potenti. Nunc massa lectus, pharetra vehicula arcu bibendum, imperdiet sodales ipsum. Nam ac sapien diam. Mauris iaculis fringilla mattis. Pellentesque tempus eros sit amet justo volutpat mollis. Phasellus ac turpis ipsum. Morbi vel ante elit. Aenean posuere quam consequat velit varius suscipit. Donec tempor quam ut nibh cursus efficitur.
Morbi molestie dolor nec sem egestas suscipit. Etiam placerat pharetra lectus, et ullamcorper risus tristique in. Sed faucibus ullamcorper lectus eget fringilla. Maecenas malesuada hendrerit congue. Sed eget neque a erat placerat tincidunt. Aliquam vitae dignissim turpis. Fusce at placerat magna, a laoreet lectus. Maecenas a purus nec diam gravida fringilla. Nam malesuada euismod ante non vehicula. In faucibus bibendum leo, faucibus posuere nisl pretium quis. Fusce finibus bibendum finibus. Vestibulum eu justo maximus, hendrerit diam nec, dignissim sapien. Aenean dolor lacus, malesuada quis vestibulum ac, venenatis ac ipsum. Cras a est id nunc finibus facilisis. Cras lacinia neque et interdum vehicula. Suspendisse vulputate tellus elit, eget tempor dui finibus vel.
Cras sed pretium odio. Proin hendrerit elementum felis in tincidunt. Nam sed turpis vel justo molestie accumsan condimentum eu nunc. Praesent lobortis euismod rhoncus. Nulla vitae euismod nibh, quis mattis mi. Fusce ultrices placerat porttitor. Duis sem ipsum, pellentesque sit amet odio a, molestie vulputate mauris.
Duis blandit mollis ligula, sit amet mattis ligula finibus sit amet. Nunc a leo molestie, placerat diam et, vestibulum leo. Suspendisse facilisis neque purus, nec pellentesque ligula fermentum nec. Aenean malesuada mauris lorem, eu blandit arcu pulvinar quis. Duis laoreet urna lacus, non maximus arcu rutrum ultricies. Nulla augue dolor, suscipit eu mollis eu, aliquam condimentum diam. Ut semper orci luctus, pharetra turpis at, euismod mi. Nulla leo diam, finibus sit amet purus sed, maximus dictum lorem. Integer eu mi id turpis laoreet rhoncus.
Integer a mauris tincidunt, finibus orci ut, pretium mauris. Nulla molestie nunc mi, id finibus lorem elementum sed. Proin quis laoreet ante. Integer nulla augue, commodo id molestie quis, rutrum ut turpis. Suspendisse et tortor turpis. Sed ut pharetra massa. Pellentesque elementum blandit sem, ut elementum tellus egestas a. Fusce eu purus nibh.
Cras dignissim ligula scelerisque magna faucibus ullamcorper. Proin at condimentum risus, auctor malesuada quam. Nullam interdum interdum egestas. Nulla aliquam nisi vitae felis mollis dictum. Suspendisse dapibus consectetur tortor. Ut ut nisi non sem bibendum tincidunt. Vivamus suscipit leo quis gravida dignissim.
Aliquam interdum, leo id vehicula mollis, eros eros rhoncus diam, non mollis ligula mi eu mauris. Sed ultrices vel velit sollicitudin tincidunt. Nunc auctor metus at ligula gravida elementum. Praesent interdum eu elit et mollis. Duis egestas quam sit amet velit dignissim consequat. Aliquam ac turpis nec nunc convallis sagittis. Fusce blandit, erat ac fringilla consectetur, dolor eros sodales leo, vel aliquet risus nisl et diam. Aliquam luctus felis vitae est eleifend euismod facilisis et lacus. Sed leo tellus, auctor eu arcu in, volutpat sagittis nisl. Pellentesque nisl ligula, placerat vel ullamcorper at, vulputate ac odio. Morbi ac faucibus orci, et tempus nulla. Proin rhoncus rutrum dolor, in venenatis mauris. Suspendisse a fermentum augue, non semper mi. Nunc eget pretium neque. Phasellus augue erat, feugiat ac aliquam congue, rutrum non sapien. Pellentesque ac diam gravida, consectetur felis at, ornare neque.
Nullam interdum mattis sapien quis porttitor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus aliquet rutrum ipsum id euismod. Maecenas consectetur massa et mi porta viverra. Nunc quam nibh, dignissim vitae maximus et, ullamcorper nec lorem. Nunc vitae justo dapibus, luctus lacus vitae, pretium elit. Maecenas et efficitur leo. Curabitur mauris lectus, placerat quis vehicula vitae, auctor ut urna. Quisque rhoncus pharetra luctus. In hac habitasse platea dictumst. Integer sit amet metus nec eros malesuada aliquam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi hendrerit mi ac leo aliquam, sit amet ultricies libero commodo. Mauris dapibus purus metus, sit amet viverra nibh imperdiet et. Nullam porta nulla tellus, quis vehicula diam imperdiet non. Vivamus enim massa, bibendum in fermentum in, ultrices at ex.
Suspendisse fermentum id nibh eget accumsan. Duis dapibus bibendum erat ut sollicitudin. Aliquam nec felis risus. Pellentesque rhoncus ligula id sem maximus mollis sed nec massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ipsum ipsum, sodales sed enim id, convallis faucibus eros. Donec ultricies dictum tincidunt. Cras vitae nibh arcu. Pellentesque cursus, sapien nec consequat fermentum, ipsum ante suscipit dui, imperdiet hendrerit est nisl eu massa. Quisque vitae sem ligula. Aenean iaculis metus ut mauris interdum laoreet. Vivamus sed gravida dolor.
Morbi nulla metus, porttitor sed eros sit amet, efficitur efficitur est. In vel nisl urna. Ut aliquet tellus at congue convallis. Phasellus imperdiet lobortis sollicitudin. Integer sodales, sem eu ultricies pharetra, erat erat porttitor odio, eget dapibus libero ipsum eget velit. Phasellus gravida nulla nisl, eu pharetra mi auctor vel. Sed blandit pharetra velit, ut egestas libero placerat non. Aliquam a interdum quam. Proin at tortor nec dui sollicitudin tempus sed vestibulum elit. Nunc non sollicitudin velit.
Aenean consequat diam velit, sed rutrum tortor faucibus dictum. Quisque at semper augue. Duis ut est eget mi ornare bibendum id et ligula. Phasellus consequat tortor non leo pulvinar posuere. Proin vestibulum eleifend felis, in hendrerit tortor sollicitudin eu. Phasellus hendrerit, lacus vel laoreet interdum, dui tortor consequat justo, commodo ultricies arcu felis vitae enim. Vivamus eu sapien at leo suscipit rutrum eu at justo. Aenean et dolor a libero ullamcorper posuere. Integer laoreet placerat nisi in vulputate. Mauris laoreet eget risus sed cursus. Donec scelerisque neque a libero eleifend hendrerit. Nulla varius condimentum nunc sit amet fermentum. Aliquam lorem ex, varius nec mollis ut, ultrices in neque. Morbi sit amet porta leo. Integer iaculis fermentum lacus in vestibulum.
Ut gravida, tellus ut maximus ultrices, erat est venenatis nisl, vitae pretium massa ex ac magna. Sed non purus eget ligula aliquet volutpat non quis arcu. Nam aliquam tincidunt risus, sit amet fringilla sapien vulputate ut. Mauris luctus suscipit pellentesque. Nunc porttitor dapibus ex quis tempus. Ut ullamcorper metus a eros vulputate, vitae viverra lectus convallis. Mauris semper imperdiet augue quis tincidunt. Integer porta pretium magna, sed cursus sem scelerisque sollicitudin. Nam efficitur, nibh pretium eleifend vestibulum, purus diam posuere sem, in egestas mauris augue sit amet urna.
Vestibulum tincidunt euismod massa in congue. Duis interdum metus non laoreet fringilla. Donec at ligula congue, tincidunt nunc non, scelerisque nunc. Donec bibendum magna non est scelerisque feugiat at nec neque. Ut orci tortor, tempus eget massa non, dignissim faucibus dolor. Nam odio risus, accumsan pretium neque eget, accumsan dignissim dui. In ut neque auctor, scelerisque tellus sed, ullamcorper nisi. Suspendisse varius cursus quam at hendrerit. Vivamus elit libero, sagittis vitae sem ac, vulputate iaculis ligula.
Sed lobortis laoreet purus sit amet rutrum. Pellentesque feugiat non leo vel lacinia. Quisque feugiat nisl a orci bibendum vestibulum. In et sollicitudin urna. Morbi a arcu ac metus faucibus tempus. Nam eu imperdiet sapien, suscipit mattis tortor. Aenean blandit ipsum nisi, a eleifend ligula euismod at. Integer tincidunt pharetra felis, mollis placerat mauris hendrerit at. Curabitur convallis, est sit amet luctus volutpat, massa lacus cursus augue, sed eleifend magna quam et risus. Aliquam lobortis tincidunt metus vitae porttitor. Suspendisse potenti. Aenean ullamcorper, neque id commodo luctus, nulla nunc lobortis quam, id dapibus neque dui nec mauris. Etiam quis lorem quis elit commodo ornare. Ut pharetra purus ultricies enim ultrices efficitur. Proin vehicula tincidunt molestie. Mauris et placerat sem.
Aliquam erat volutpat. Suspendisse velit turpis, posuere ac lacus eu, lacinia laoreet velit. Sed interdum felis neque, id blandit sem malesuada sit amet. Ut sagittis justo erat, efficitur semper orci tempor sed. Donec enim massa, posuere varius lectus egestas, pellentesque posuere mi. Cras tincidunt ut libero sed mattis. Suspendisse quis magna et tellus posuere interdum vel at purus. Pellentesque fringilla tristique neque, id aliquet tellus ultricies non. Duis ut tellus vel odio lobortis vulputate.
Integer at magna ac erat convallis vestibulum. Sed lobortis porttitor mauris. Fusce varius lorem et volutpat pulvinar. Aenean ac vulputate lectus, vitae consequat velit. Suspendisse ex dui, varius ut risus ut, dictum scelerisque sem. Vivamus urna orci, volutpat ut convallis ac, venenatis vitae urna. In hac habitasse platea dictumst. Etiam eu purus arcu. Aenean vulputate leo urna, vel tristique dui sagittis euismod. Suspendisse non tellus efficitur ante rhoncus volutpat at et sapien.
Sed dapibus accumsan porttitor. Phasellus facilisis lectus finibus ligula dignissim, id pulvinar lectus feugiat. Nullam egestas commodo nisi posuere aliquet. Morbi sit amet tortor sagittis, rutrum dui nec, dapibus sapien. Sed posuere tortor tortor, interdum auctor magna varius vitae. Vestibulum id sagittis augue. Curabitur fermentum arcu sem, eu condimentum quam rutrum non. Phasellus rutrum nibh quis lectus rhoncus pretium. Curabitur dictum interdum elit. Vestibulum maximus sodales imperdiet. Mauris auctor nec purus sed venenatis. In in urna purus.
Duis placerat molestie suscipit. Morbi a elit id purus efficitur consequat. Nunc ac commodo turpis. Etiam sit amet lacus a ipsum tempus venenatis sed vel nibh. Duis elementum aliquam mi sed tristique. Morbi ligula tortor, semper ac est vel, lobortis maximus erat. Curabitur ipsum felis, laoreet vel condimentum eget, ullamcorper sit amet mauris. Nulla facilisi. Nam at purus sed mi egestas placerat vitae vel magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse at dignissim diam. Phasellus consectetur eget neque vel viverra. Donec sollicitudin mattis dolor vel malesuada. Vivamus vehicula leo neque, vitae fermentum leo posuere et. Praesent dui est, finibus sit amet tristique quis, pharetra vel nibh.
Duis nulla leo, accumsan eu odio eget, sagittis semper orci. Quisque ullamcorper ligula quam, commodo porttitor mauris ullamcorper eu. Cras varius sagittis felis in aliquam. Duis sodales risus ac justo vehicula, nec mattis diam lacinia. Cras eget lectus ipsum. Ut commodo, enim vitae malesuada hendrerit, ex dolor egestas lectus, sit amet hendrerit metus diam nec est. Vestibulum tortor metus, lobortis sit amet ante eget, tempor molestie lacus. In molestie et urna et semper. Mauris mollis, sem non hendrerit condimentum, sapien nisi cursus est, non suscipit quam justo non metus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam enim est, porta ac feugiat vitae, rutrum in lorem. Duis vehicula tortor ut posuere maximus.
Nullam vestibulum non tellus sed commodo. Quisque mattis elit sit amet sapien sollicitudin, ut condimentum nisl congue. Aenean sagittis massa vel elit faucibus fermentum. Donec tincidunt nisi nec nisl sodales pellentesque. Mauris congue congue ligula ut suscipit. Vivamus velit tortor, tempor et gravida eget, fermentum sit amet ante. Nullam fringilla, lorem at ultrices cursus, urna neque ornare dolor, eu lacinia orci enim sed nibh. Ut a ullamcorper lectus, id mattis purus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean maximus sollicitudin posuere. Nunc at augue lacus. Aenean efficitur leo sit amet lacinia efficitur.
Quisque venenatis quam mi, in pharetra odio vulputate eu. In vel nisl pulvinar, pulvinar ligula ut, sodales risus. Sed efficitur lectus at vestibulum tincidunt. Vestibulum eu ullamcorper elit. Fusce vestibulum magna enim, et tempor lacus posuere vitae. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer leo elit, luctus nec mattis sit amet, sollicitudin in turpis.
Proin convallis venenatis leo, vitae tristique erat iaculis nec. Nulla facilisi. Duis porttitor, sapien et bibendum vulputate, sem libero sodales lacus, non malesuada felis erat ut libero. Nam non felis semper, finibus est a, mattis mauris. Praesent nec eros quam. Nulla hendrerit, augue consectetur eleifend ultricies, purus mi condimentum nulla, eget dapibus est nunc sed libero. Nullam elementum dui erat, vitae luctus libero sollicitudin et. Nulla odio magna, placerat in augue eu, dapibus imperdiet odio. Suspendisse imperdiet metus sit amet rhoncus dapibus. Cras at enim et urna vehicula cursus eu a mauris. Integer magna ante, eleifend ac placerat vitae, porta at nisi. Cras eget malesuada orci. Curabitur nunc est, vulputate id viverra et, dignissim sed odio. Curabitur non mattis sem. Sed bibendum, turpis vitae vehicula faucibus, nunc quam ultricies lectus, vitae viverra felis turpis at libero.
Nullam ut egestas ligula. Proin hendrerit justo a lectus commodo venenatis. Nulla facilisi. Ut cursus lorem quis est bibendum condimentum. Aenean in tristique odio. Fusce tempor hendrerit ipsum. Curabitur mollis felis justo, quis dapibus erat auctor vel. Sed augue lectus, finibus ut urna quis, ullamcorper vestibulum dui. Etiam molestie aliquam tempor. Integer mattis sollicitudin erat, et tristique elit varius vel. Mauris a ex justo.
Nam eros est, imperdiet non volutpat rutrum, pellentesque accumsan ligula. Duis sit amet turpis metus. Aenean in rhoncus metus, ac fringilla ex. Suspendisse condimentum egestas purus, ut pharetra odio vulputate vel. Duis tincidunt massa a placerat ultrices. Mauris ultricies nibh sit amet condimentum malesuada. Duis tincidunt id ipsum sed congue.
Praesent eu ex augue. Nullam in porta ligula. In tincidunt accumsan arcu, in pellentesque magna tristique in. Mauris eleifend libero ac nisl viverra faucibus. Nam sollicitudin dolor in commodo hendrerit. Cras at orci metus. Ut quis laoreet orci. Vivamus ultrices leo pellentesque tempor aliquet. Maecenas ut eros vitae purus placerat vestibulum. Etiam vitae gravida dolor, quis rhoncus diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Suspendisse fringilla lacinia sagittis. Integer tincidunt consectetur tristique. Morbi non orci convallis, congue sapien quis, vulputate nunc. Donec a libero vel magna elementum facilisis non quis mi. Mauris posuere tellus non ipsum ultrices elementum. Vivamus massa velit, facilisis quis placerat aliquet, aliquet nec leo. Praesent a maximus sem. Sed neque elit, feugiat vel quam non, molestie sagittis nunc. Etiam luctus nunc ac mauris scelerisque, nec rhoncus lacus convallis. Nunc pharetra, nunc ac pulvinar aliquam, ex ipsum euismod augue, nec porttitor lacus turpis vitae neque. Fusce bibendum odio id tortor faucibus pellentesque. Sed ac porta nibh, eu gravida erat.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam quis ullamcorper felis. Nulla mattis sagittis ante ac tincidunt. Integer ac felis efficitur, viverra libero et, facilisis ligula. Suspendisse a metus a massa rhoncus posuere. Phasellus suscipit ligula ut lacus facilisis, ac pellentesque ex tempor. Quisque consectetur massa mi, ac molestie libero dictum quis. Proin porttitor ligula quis erat tincidunt venenatis. Proin congue nunc sed elit gravida, nec consectetur lectus sodales. Etiam tincidunt convallis ipsum at vestibulum. Quisque maximus enim et mauris porttitor, et molestie magna tristique. Morbi vitae metus elit. Maecenas sed volutpat turpis. Aliquam vitae dolor vestibulum, elementum purus eget, dapibus nibh. Nullam egestas dui ac rutrum semper.
Etiam hendrerit est metus, et condimentum metus aliquam ac. Pellentesque id neque id ipsum rhoncus vulputate. Aliquam erat nisl, posuere sit amet ligula ac, fermentum blandit felis. Vivamus fermentum mi risus, non lacinia purus viverra id. Aenean ac sapien consequat, finibus mauris nec, porta sem. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed quis consectetur ex, dignissim bibendum nulla. Phasellus ac libero at quam vehicula euismod non eu leo. Phasellus a sapien augue.
Maecenas ligula dui, bibendum vitae mauris et, auctor laoreet felis. Duis non libero a mi semper mattis. Quisque consequat luctus massa, quis tristique eros auctor feugiat. Maecenas sodales euismod neque vitae facilisis. Nullam laoreet imperdiet velit at pellentesque. Etiam massa odio, facilisis a consequat vitae, placerat vel magna. Nunc sagittis eros nec urna fringilla, pulvinar vestibulum nibh scelerisque. Sed magna metus, cursus eu consequat et, pharetra a est. Suspendisse elementum neque a dui malesuada lacinia. Donec sed ipsum volutpat, cursus urna id, ullamcorper arcu. Maecenas laoreet nisl eget velit egestas sollicitudin. Etiam nisl turpis, mollis id dignissim vitae, tristique vehicula ante. Maecenas eget placerat est, at rutrum augue. Vivamus faucibus lacinia ullamcorper. Sed pulvinar urna sodales ante sodales, at gravida leo dictum.
Morbi maximus, quam a lobortis bibendum, enim felis varius elit, ac vehicula elit nisl ut lacus. Quisque ut arcu augue. Praesent id turpis quam. Sed sed arcu eros. Maecenas at cursus lorem, ac eleifend nisi. Fusce mattis felis at commodo pharetra. Praesent ac commodo ipsum. Quisque finibus et eros vitae tincidunt. In hac habitasse platea dictumst. Praesent purus ipsum, luctus lobortis ornare quis, auctor eget justo. Nam vel enim sollicitudin, faucibus tortor eu, sagittis eros. Ut nec consectetur erat. Donec ultricies malesuada ligula, a hendrerit sapien volutpat in. Maecenas sed enim vitae sapien pulvinar faucibus.
Proin semper nunc nibh, non consequat neque ullamcorper vel. Maecenas lobortis sagittis blandit. Aenean et arcu ultricies turpis malesuada malesuada. Ut quam ex, laoreet ut blandit cursus, feugiat vitae dolor. Etiam ex lacus, scelerisque vel erat vel, efficitur tincidunt magna. Morbi tristique lacinia dolor, in egestas magna ultrices vitae. Integer ultrices leo ac tempus venenatis. Praesent ac porta tortor. Vivamus ornare blandit tristique. Nulla rutrum finibus pellentesque. In non dui elementum, fermentum ipsum vel, varius magna. Pellentesque euismod tortor risus, ac pellentesque nisl faucibus eget.
Vivamus eu enim purus. Cras ultrices rutrum egestas. Sed mollis erat nibh, at posuere nisl luctus nec. Nunc vulputate, sapien id auctor molestie, nisi diam tristique ante, non convallis tellus nibh at orci. Morbi a posuere purus, in ullamcorper ligula. Etiam elementum sit amet dui imperdiet iaculis. Proin vitae tincidunt ipsum, sit amet placerat lectus. Curabitur commodo sapien quam, et accumsan lectus fringilla non. Nullam eget accumsan enim, ac pharetra mauris. Sed quis tristique velit, vitae commodo nisi. Duis turpis dui, maximus ut risus at, finibus consequat nunc. Maecenas sed est accumsan, aliquet diam in, facilisis risus. Curabitur vehicula rutrum auctor. Nam iaculis risus pulvinar maximus viverra. Nulla vel augue et ex sagittis blandit.
Ut sem nulla, porta ac ante ac, posuere laoreet eros. Donec sodales posuere justo a auctor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras mollis at orci hendrerit porta. Nullam sodales tortor tortor, non lacinia diam finibus id. Duis libero orci, suscipit ac odio et, dictum consequat ipsum. Pellentesque eu ligula sagittis, volutpat eros at, lacinia lorem. Cras euismod tellus in iaculis tempor. Quisque accumsan, magna a congue venenatis, ante ipsum aliquam lectus, at egestas enim nunc at justo. Quisque sem purus, viverra ut tristique ut, maximus id enim. Etiam quis placerat sem. In sollicitudin, lacus eu rutrum mollis, nulla eros luctus elit, vel dapibus urna purus nec urna. Phasellus egestas massa quam, ac molestie erat hendrerit a. Praesent ultrices neque ut turpis molestie auctor. Etiam molestie placerat purus, et euismod erat aliquam in. Morbi id suscipit justo.
Proin est ante, consequat at varius a, mattis quis felis. Sed accumsan nibh sit amet ipsum elementum posuere. Vestibulum bibendum id diam sit amet gravida. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi nec dolor vel ipsum dignissim hendrerit vel non ipsum. Praesent facilisis orci quis elit auctor lobortis. Phasellus cursus risus lectus, vel lobortis libero dapibus in. Quisque tristique tempus leo a pulvinar. Pellentesque a magna tincidunt, pellentesque massa nec, laoreet orci. Morbi congue ornare dolor quis commodo. Phasellus massa nisi, tincidunt at eros dictum, hendrerit lobortis urna. Maecenas porta, magna id mattis molestie, nibh tellus lobortis sem, eget tincidunt ipsum quam eu turpis.
Ut gravida orci risus, vel rutrum mauris vehicula id. Etiam bibendum, neque a placerat condimentum, ex orci imperdiet lectus, quis dapibus arcu lacus eget lectus. Sed consequat non mi sit amet venenatis. Fusce vestibulum erat libero, eget hendrerit risus vulputate sollicitudin. Integer sed eleifend felis. Donec commodo, sem eu mattis placerat, urna odio aliquam tellus, et laoreet justo tellus eget erat. Fusce sed suscipit tortor. Nam hendrerit nibh ac nunc auctor lacinia. Pellentesque placerat condimentum ipsum, eget semper tortor hendrerit vel. Nullam non urna eu lacus pellentesque congue ut id eros.
Nunc finibus leo in rhoncus tristique. Sed eu ipsum nec nisl egestas faucibus eget a felis. Pellentesque vitae nisi in nulla accumsan fermentum. Sed venenatis feugiat eleifend. Fusce porttitor varius placerat. Aliquam aliquet lacus sit amet mattis mollis. Sed vel nulla quis dolor suscipit vehicula ac viverra lorem. Duis viverra ipsum eget nulla ullamcorper fermentum. Mauris tincidunt arcu quis quam fringilla ornare. Donec et iaculis tortor. Nam ultricies libero vel ipsum aliquet efficitur. Morbi eget dolor aliquam, tempus sapien eget, viverra ante. Donec varius mollis ex, sed efficitur purus euismod interdum. Quisque vel sapien non neque tincidunt semper. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Suspendisse sit amet purus leo. Fusce lectus lorem, aliquam ac nulla eget, imperdiet ornare eros. Nullam sem augue, varius in nisi non, sollicitudin pellentesque ante. Etiam eu odio condimentum, tempor libero et, egestas arcu. Cras pellentesque eleifend aliquet. Pellentesque non blandit ligula. Ut congue viverra rhoncus. Phasellus mattis mi ac eros placerat, eu feugiat tellus ultrices. Aenean mollis laoreet libero eu imperdiet. Cras sed pulvinar mi, ac vehicula ligula. Vestibulum sit amet ex massa. In a egestas eros.
Mauris pretium ipsum risus, venenatis cursus ante imperdiet id. Praesent eu turpis nec risus feugiat maximus ullamcorper ac lectus. Integer placerat at mi vel dapibus. Vestibulum fermentum turpis sit amet turpis viverra, id aliquet diam suscipit. Nam nec ex sed ante ullamcorper pharetra quis sit amet risus. Sed ac faucibus velit, id feugiat nibh. Nullam eget ipsum ex. Vivamus tincidunt non nunc non faucibus. Quisque bibendum viverra facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at nisi hendrerit quam suscipit egestas. Curabitur laoreet maximus ultricies. Duis ut tellus ac augue molestie dictum.
Suspendisse rhoncus iaculis erat, ut ullamcorper est tristique eget. Donec auctor nec risus at gravida. Vivamus volutpat vulputate tellus, vel ultricies eros suscipit eget. Ut pulvinar id mi eu tempus. Morbi malesuada augue in dui varius, nec blandit neque vehicula. Donec ornare nec nisl in mollis. Morbi enim nisi, rhoncus nec est id, dapibus tempus urna. Ut id elit a felis vestibulum consectetur. Duis lectus quam, pharetra sit amet diam sed, posuere vestibulum erat. Fusce vitae maximus massa. Nullam id metus tempus, iaculis risus eu, lobortis urna. Quisque in congue urna. Pellentesque placerat neque in augue dapibus, non varius ex malesuada. Curabitur ut eleifend libero. Fusce vitae ligula luctus, fermentum enim vitae, ultrices erat.
Sed viverra augue turpis, scelerisque egestas sapien mattis eu. Duis laoreet magna at ex pharetra dapibus. Praesent eget odio vel quam venenatis dictum. Nulla in sollicitudin dolor. Mauris lobortis nec eros vel rhoncus. Vestibulum porta viverra venenatis. Curabitur vel scelerisque quam, a egestas velit. Praesent volutpat tincidunt magna at laoreet.
Cras nec lorem odio. Pellentesque quis dui urna. Praesent at tellus ac lectus scelerisque placerat nec eu risus. Vestibulum sit amet mattis ligula. Vivamus sed nisi at leo elementum accumsan at sit amet arcu. Aenean mattis tellus nec leo gravida, eget hendrerit nisl faucibus. Mauris pellentesque luctus condimentum. Maecenas pretium sapien nunc, eget commodo dolor maximus id. Mauris vestibulum accumsan massa a dictum. Phasellus interdum quam ligula, ut maximus diam blandit aliquam. Nunc vitae ex eu erat condimentum consectetur. Maecenas interdum condimentum volutpat.
Donec et enim a libero rutrum laoreet. Praesent a condimentum sem, at tincidunt quam. In vel molestie risus. Sed urna dui, molestie vitae mollis laoreet, tempor quis lectus. Praesent vitae auctor est, et aliquet nunc. Curabitur vulputate blandit nulla, at gravida metus. Maecenas gravida dui eu iaculis tristique. Pellentesque posuere turpis nec auctor eleifend. Suspendisse bibendum diam eu tellus lobortis, et laoreet quam congue. In hac habitasse platea dictumst. Morbi dictum neque velit, eget rutrum eros ultrices sit amet.
Phasellus fermentum risus pharetra consectetur bibendum. Donec magna tortor, lacinia vitae nibh quis, aliquet pretium lorem. Donec turpis nisi, pretium eu enim volutpat, mattis malesuada augue. Nullam vel tellus iaculis, sollicitudin elit eget, tincidunt lacus. Fusce elementum elementum felis et iaculis. Suspendisse porta eros nec neque malesuada, in malesuada ante sollicitudin. Vivamus bibendum viverra molestie.
Integer feugiat, erat nec convallis aliquam, velit felis congue erat, molestie eleifend tellus erat in tellus. Nunc et justo purus. Donec egestas fermentum dui non feugiat. Quisque in sapien sagittis, gravida quam id, iaculis lectus. Cras sagittis rhoncus bibendum. Fusce quis metus in velit scelerisque tincidunt at non ipsum. Vivamus efficitur ante eu odio vulputate, vitae ultricies risus vehicula. Proin eget odio eu sem tincidunt feugiat vel id lorem.
Vestibulum sit amet nulla dignissim, euismod mi in, fermentum tortor. Donec ut aliquet libero, lacinia accumsan velit. Donec et nulla quam. Nullam laoreet odio nec nunc imperdiet, a congue eros venenatis. Quisque nec tellus sit amet neque interdum posuere. Duis quis mi gravida, tincidunt diam convallis, ultricies augue. Mauris consequat risus non porttitor congue. Ut in ligula consequat, viverra nunc a, eleifend enim. Duis ligula urna, imperdiet nec facilisis et, ornare eu ex. Proin lobortis lectus a lobortis porttitor. Nulla leo metus, egestas eu libero sed, pretium faucibus felis. Vestibulum non sem tortor. Nam cursus est leo. Vivamus luctus enim odio, non interdum sem dapibus a. Aenean accumsan consequat lectus in imperdiet.
Donec vehicula laoreet ipsum in posuere. Quisque vel quam imperdiet, sollicitudin nisi quis, suscipit velit. Morbi id sodales mauris. Curabitur tellus arcu, feugiat sed dui sit amet, sodales sagittis libero. Aenean vel suscipit metus, non placerat leo. Vestibulum quis nulla elit. Proin scelerisque non ante ut commodo. Interdum et malesuada fames ac ante ipsum primis in faucibus.
Sed non urna dolor. Suspendisse convallis mi porta pulvinar ultrices. Suspendisse quam ipsum, hendrerit non scelerisque molestie, interdum dictum nunc. Morbi condimentum condimentum turpis eu luctus. Pellentesque sagittis sollicitudin odio, sed ultricies felis ornare sit amet. Sed ultrices ex leo, a tincidunt nisl gravida sed. Nullam ornare accumsan porta. Praesent consectetur id est nec sollicitudin.
In hac habitasse platea dictumst. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed sed ultrices nibh. Duis accumsan suscipit eros, a dictum odio tempus sit amet. Aenean imperdiet erat ac lacus finibus, scelerisque cursus massa imperdiet. Mauris molestie risus ut lacinia posuere. Nulla et sodales purus. Maecenas orci erat, placerat in tristique quis, placerat in mi.
Donec sollicitudin pellentesque odio in feugiat. Morbi eu dolor ut mauris congue sollicitudin. Aliquam erat volutpat. Nulla id varius dui. Curabitur finibus urna ante, consectetur interdum nisi volutpat a. Quisque quis mi tristique, consequat tellus eget, rutrum sapien. Vivamus vitae tellus vulputate, rutrum ex eu, vulputate sem. Suspendisse viverra lorem tellus, vel interdum orci gravida quis. Ut laoreet arcu at mi ullamcorper finibus. Duis porta sagittis vestibulum. Sed commodo nisl vitae urna sollicitudin, nec lacinia est sodales. Curabitur imperdiet sodales dui sed iaculis. Sed ac tellus maximus, eleifend quam sit amet, feugiat elit. Aenean viverra, dui at mattis varius, est odio vestibulum sapien, sit amet mollis libero massa nec velit. Etiam quis sodales justo.
Ut ultricies, sem eget sodales feugiat, nunc arcu congue elit, ac tempor justo massa nec purus. Maecenas enim nunc, pharetra eget dictum sit amet, tempus pellentesque velit. Suspendisse venenatis ligula in nulla mattis, et imperdiet ex tincidunt. Etiam vulputate, tellus et ultrices suscipit, enim velit laoreet massa, vitae congue odio enim ac urna. Morbi quam lorem, iaculis ac varius sagittis, euismod quis dolor. In ut dui eu purus feugiat consectetur. Vestibulum cursus velit quis lacus pellentesque iaculis. Cras in risus sed mauris porta rutrum. Nulla facilisi. Nullam eu bibendum est, non pellentesque lectus. Sed imperdiet feugiat lorem, quis convallis ante auctor in. Maecenas justo magna, scelerisque sit amet tellus eget, varius elementum risus. Duis placerat et quam sed varius.
Duis nec nibh vitae nibh dignissim mollis quis sed felis. Curabitur vitae quam placerat, venenatis purus ut, euismod nisl. Curabitur porttitor nibh eu pulvinar ullamcorper. Suspendisse posuere nec ipsum ac dapibus. Cras convallis consectetur urna. Phasellus a nibh in dolor lacinia posuere id eget augue. In eu pharetra lorem, vitae cursus lacus. Aliquam tincidunt nibh lectus. Aenean facilisis ultricies posuere. Sed ut placerat orci. Curabitur scelerisque gravida blandit. Maecenas placerat ligula eget suscipit fringilla. Mauris a tortor justo. Aliquam hendrerit semper mollis. Phasellus et tincidunt libero. Etiam vel quam libero.
Quisque aliquet tempor ex. Ut ante sem, vehicula at enim vel, gravida porta elit. Etiam vitae lacus a neque lobortis consectetur. Mauris sed interdum odio. Mauris elementum ex blandit tempor cursus. Integer in enim in leo viverra elementum. Fusce consectetur metus et sem rutrum, mattis euismod diam semper. Nunc sed ipsum vel urna consequat vehicula. Donec cursus pretium lorem, vestibulum pretium felis commodo sit amet. Nam blandit felis enim, eget gravida ex faucibus a. In nec neque massa. Etiam laoreet posuere ipsum. Praesent volutpat nunc dolor, ac vulputate magna facilisis non. Aenean congue turpis vel lectus sollicitudin tristique. Sed nec consequat purus, non vehicula quam. Etiam ultricies, est ac dictum tincidunt, turpis turpis pretium massa, a vulputate libero justo at nibh.
Aliquam erat volutpat. Cras ultrices augue ac sollicitudin lobortis. Curabitur et aliquet purus. Duis feugiat semper facilisis. Phasellus lobortis cursus velit, a sollicitudin tortor. Nam feugiat sapien non dapibus condimentum. Morbi at mi bibendum, commodo quam at, laoreet enim. Integer eu ultrices enim. Sed vestibulum eu urna ut dictum. Curabitur at mattis leo, sed cursus massa. Aliquam porttitor, felis quis fermentum porttitor, justo velit feugiat nulla, eget condimentum sem dui ut sapien.
In fringilla elit eu orci aliquam consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut eget fringilla tellus. Curabitur fermentum, mi et condimentum suscipit, elit neque bibendum dui, et hendrerit nunc metus id ipsum. Morbi placerat mi in hendrerit congue. Ut feugiat mauris eget scelerisque viverra. Vivamus sit amet erat dictum, sagittis lectus nec, pulvinar lorem. Sed non enim ac dui sollicitudin aliquet. Quisque ut lacus dolor. Fusce hendrerit malesuada euismod. Nulla faucibus vel mauris eu mollis. Mauris est diam, fringilla ac arcu feugiat, efficitur volutpat turpis. Aliquam venenatis cursus massa sed porttitor. Ut ac finibus enim, in tincidunt sapien.
Nunc faucibus semper turpis a lacinia. Phasellus gravida, libero vel pulvinar ornare, ex sem tincidunt lectus, sit amet convallis augue risus at tortor. Quisque sit amet ipsum id nulla posuere vestibulum. Pellentesque scelerisque mauris vel leo viverra sodales. Nulla viverra aliquam ex, ut rutrum enim fermentum venenatis. Aenean eget dapibus ex, eget faucibus metus. Vestibulum volutpat leo in diam semper, eget porta magna suscipit. Sed sit amet nulla blandit, aliquam dolor ac, gravida velit. Sed vel velit viverra, maximus est id, convallis justo.
Curabitur nulla ante, vulputate at libero vel, ullamcorper rutrum nibh. Pellentesque porttitor eu mauris id mattis. Duis vulputate augue elit, eget interdum justo pretium vel. Maecenas eu vulputate arcu, eget posuere purus. Suspendisse viverra a velit dictum eleifend. Suspendisse vitae dapibus diam. Donec vehicula justo in ante interdum, eu luctus diam placerat. Vivamus convallis ipsum eu orci suscipit, sed fermentum enim euismod. Maecenas faucibus elit vitae ex ornare tristique. Donec vestibulum nec elit sit amet porttitor. Aenean tempor lectus eget tortor hendrerit luctus. Nullam interdum vitae lectus vel feugiat. Cras in risus non magna consectetur lobortis. Sed faucibus enim quis gravida convallis.
Phasellus eget massa sit amet libero ultrices suscipit. Vivamus at risus sapien. Nam mollis nunc eget velit dictum maximus. Sed pellentesque, nunc ac fringilla lacinia, quam enim mattis ex, sed euismod tortor metus eu neque. Ut mattis nisl ut lectus rhoncus, sodales bibendum eros porta. Nulla porttitor enim nec diam sagittis, eget porta velit efficitur. Vestibulum ultricies eros neque. Phasellus rutrum suscipit enim, in interdum ante gravida vitae. Sed in sagittis diam, non commodo velit.
Morbi hendrerit odio orci, nec tincidunt odio rhoncus nec. Mauris neque velit, vehicula a lorem at, suscipit tristique dui. Sed finibus, nisl in mattis convallis, turpis neque sodales lacus, eu porta enim magna non diam. Nam commodo sodales risus consectetur malesuada. In eget elementum justo. Phasellus sit amet massa imperdiet, dapibus nunc sit amet, suscipit orci. Fusce condimentum laoreet feugiat. Ut ut viverra ante. Praesent bibendum interdum commodo. Nulla mollis nisi a est ornare volutpat. Sed at ligula eu nisi dapibus tempus. Proin cursus vestibulum justo, nec efficitur justo dignissim vel. Nunc quis maximus eros.
Cras viverra, diam a tristique mattis, libero felis vulputate tellus, a ornare felis leo a dui. Nulla ante nulla, finibus ut tellus ut, blandit pharetra nibh. Proin eleifend fermentum ex, eget auctor libero vulputate in. Nullam ultricies, mauris placerat pretium placerat, leo urna lobortis leo, vel placerat arcu libero sed mauris. Aliquam mauris ligula, ornare at urna at, eleifend gravida ligula. Vestibulum consectetur ut nulla non scelerisque. Donec ornare, sem nec elementum aliquam, urna nulla bibendum metus, eu euismod dui ligula ac est. Fusce laoreet erat eu ex lobortis, quis bibendum ligula interdum. Sed vel mi erat. Vivamus id lacus ac enim mattis tempor. Nunc ultricies pellentesque enim sed euismod. Fusce tincidunt convallis elit quis aliquam. Mauris nulla ipsum, sollicitudin quis diam ac, feugiat volutpat tellus. In nibh nibh, vulputate quis tincidunt quis, pulvinar eget magna. Pellentesque quis finibus dolor. Suspendisse viverra vitae lectus non eleifend.
Nunc ut orci et sapien maximus semper. Nulla dignissim sem urna, ac varius lectus ultricies id. Quisque aliquet pulvinar pretium. In ultricies molestie tellus vehicula porta. Nam enim lorem, aliquam eget ex et, hendrerit volutpat quam. Maecenas diam lacus, pellentesque eget tempus ac, pharetra eu elit. Donec vel eros a sem facilisis vulputate. Nullam ac nisi vulputate, laoreet nisl ac, eleifend sem. Nullam mi massa, rhoncus sed pharetra interdum, tincidunt eget nunc. Aliquam viverra mattis posuere. Mauris et dui sed nisl sollicitudin fermentum quis ut arcu. Nam placerat eget orci at tincidunt. Curabitur vel turpis metus. Phasellus nibh nulla, fermentum scelerisque sem vel, gravida tincidunt velit. Pellentesque vel quam tempor, finibus massa pellentesque, condimentum dui.
Donec at mattis neque. Etiam velit diam, consequat auctor mauris id, hendrerit faucibus metus. Maecenas ullamcorper eros a est sodales, ac consectetur odio scelerisque. Donec leo metus, imperdiet at pellentesque vel, feugiat id erat. Suspendisse at magna enim. Vestibulum placerat sodales lorem id sollicitudin. Aenean at euismod ligula, eget mollis diam. Phasellus pulvinar, orci nec pretium condimentum, est erat facilisis purus, quis feugiat augue elit aliquam nulla. Aenean vitae tortor id risus congue tincidunt. Sed dolor enim, mattis a ullamcorper id, volutpat ac leo.
Proin vehicula feugiat augue, id feugiat quam sodales quis. Donec et ultricies massa, a lacinia nulla. Duis aliquam augue ornare euismod viverra. Ut lectus risus, rutrum sit amet efficitur a, luctus nec nisl. Cras volutpat ullamcorper congue. Sed vitae odio metus. Phasellus aliquet euismod varius.
Nullam sem ex, malesuada ut magna ut, pretium mollis arcu. Nam porttitor eros cursus mi lacinia faucibus. Suspendisse aliquet eleifend iaculis. Maecenas sit amet viverra tortor. Nunc a mollis risus. Etiam tempus dolor in tortor malesuada mattis. Ut tincidunt venenatis est sit amet dignissim. Vestibulum massa enim, tristique sed scelerisque eu, fringilla ac velit. Donec efficitur quis urna sit amet malesuada. Vestibulum consequat ac ligula in dapibus. Maecenas massa massa, molestie non posuere nec, elementum ut magna. In nisi erat, mollis non venenatis eu, faucibus in justo. Morbi gravida non ex non egestas. Pellentesque finibus laoreet diam, eu commodo augue congue vitae.
Aenean sem mi, ullamcorper dapibus lobortis vitae, interdum tincidunt tortor. Vivamus eget vulputate libero. Ut bibendum posuere lectus, vel tincidunt tortor aliquet at. Phasellus malesuada orci et bibendum accumsan. Aliquam quis libero vel leo mollis porta. Sed sagittis leo ac lacus dictum, ac malesuada elit finibus. Suspendisse pharetra luctus commodo. Vivamus ultricies a odio non interdum. Vivamus scelerisque tincidunt turpis quis tempor. Pellentesque tortor ligula, varius non nunc eu, blandit sollicitudin neque. Nunc imperdiet, diam et tristique luctus, ipsum ex condimentum nunc, sit amet aliquam justo velit sed libero. Duis vel suscipit ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed tincidunt neque vel massa ultricies, id dictum leo consequat. Curabitur lobortis ultricies tellus, eget mattis nisl aliquam sit amet.
Proin at suscipit justo. Vivamus ut vestibulum nisl. Pellentesque enim odio, pharetra non magna sed, efficitur auctor magna. Praesent tincidunt ante quis ante hendrerit viverra. Pellentesque vel ipsum id magna vulputate efficitur. Sed nec neque accumsan, pulvinar sapien quis, euismod mauris. Donec condimentum laoreet sapien quis gravida. Quisque sed mattis purus. Vestibulum placerat vel neque maximus scelerisque.
Vestibulum mattis quam quis efficitur elementum. Duis dictum dolor ac scelerisque commodo. Fusce sollicitudin nisi sit amet dictum placerat. Suspendisse euismod pharetra eleifend. In eros nisl, porttitor sed mauris at, consectetur aliquet mauris. Donec euismod viverra neque sed fermentum. Phasellus libero magna, accumsan ut ultricies vitae, dignissim eget metus. Donec tellus turpis, interdum eget maximus nec, hendrerit eget massa. Curabitur auctor ligula in iaculis auctor. In ultrices quam suscipit cursus finibus. Aenean id mi at dolor interdum iaculis vitae ut lorem. Nullam sed nibh fringilla, lacinia odio nec, placerat erat. In dui libero, viverra ac viverra ac, pellentesque sit amet turpis.
Nulla in enim ex. Sed feugiat est et consectetur venenatis. Cras varius facilisis dui vel convallis. Vestibulum et elit eget tellus feugiat pellentesque. In ut ante eu purus aliquet posuere. Nulla nec ornare sem, sed luctus lorem. Nam varius iaculis odio, eget faucibus nisl ullamcorper in. Sed eget cursus felis, nec efficitur nisi.
Vivamus commodo et sem quis pulvinar. Pellentesque libero ante, venenatis vitae ligula sit amet, ornare sollicitudin nulla. Mauris eget tellus hendrerit, pulvinar metus quis, tempor nisi. Proin magna ex, laoreet sed tortor quis, varius fermentum enim. Integer eu dolor dictum, vulputate tortor et, aliquet ligula. Vestibulum vitae justo id mauris luctus sollicitudin. Suspendisse eget auctor neque, sodales egestas lorem. Vestibulum lacinia egestas metus vitae euismod. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus ex tellus, volutpat nec pulvinar sit amet, condimentum vitae dui. Curabitur vel felis sodales, lacinia nunc iaculis, ullamcorper augue. Pellentesque consequat dolor quis eros efficitur malesuada. Nulla ut malesuada lectus.
Morbi et tristique ante. Aliquam erat volutpat. Vivamus vitae dui nec turpis pellentesque fermentum. Quisque eget velit massa. Pellentesque tristique aliquam nisl, eu sollicitudin justo venenatis sed. Duis eleifend sem eros, ut aliquam libero porttitor id. Sed non nunc consequat, rhoncus diam eu, commodo erat. Praesent fermentum in lectus id blandit. Donec quis ipsum at justo volutpat finibus. Nulla blandit justo nulla, at mollis lacus consequat eget. Aenean sollicitudin quis eros ut ullamcorper.
Pellentesque venenatis nulla ut mi aliquet feugiat. Cras semper vel magna nec pharetra. Integer mattis felis et sapien commodo imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis quis luctus felis. Vestibulum justo nibh, aliquam non lectus vitae, molestie placerat justo. Donec lorem nibh, gravida sit amet hendrerit ac, maximus id ipsum. Nunc ac libero sodales risus eleifend sagittis. Phasellus est massa, lobortis elementum ex sed, scelerisque consectetur neque. Nunc faucibus neque id lorem malesuada, eget convallis ex mattis.
Sed turpis tortor, fermentum non turpis id, posuere varius nibh. Donec iaculis lorem dui. Etiam eros ante, sodales eget venenatis at, consectetur eget risus. Curabitur non aliquam ante, a pretium justo. Maecenas tempor nisl tortor, vitae dictum nisi ultrices eu. Duis eget dui ultrices, porttitor lacus sed, lobortis purus. Quisque mattis elit nec neque sagittis, sed commodo leo blandit. Mauris sodales interdum eleifend. Vestibulum condimentum consectetur augue, id luctus diam convallis et.
Nunc suscipit risus in justo accumsan, a placerat magna tincidunt. Proin a nisl ipsum. Sed libero dui, tristique in augue quis, auctor tristique risus. Sed porttitor ex augue, eu porta augue molestie a. Duis rhoncus purus libero, eu tempus turpis condimentum at. Sed mollis nisi id lectus placerat tincidunt. Maecenas non scelerisque elit, quis rutrum orci. Donec in tellus pharetra urna ornare lobortis. Phasellus id risus at nisi varius rutrum eu ut turpis.
Duis dictum justo quis nisl porta, eget tincidunt magna suscipit. Sed velit massa, ullamcorper eu sodales ac, pretium a massa. Duis et rutrum tortor. Nulla accumsan hendrerit sapien, cursus volutpat eros egestas eget. Donec sollicitudin at ante quis sollicitudin. Aenean blandit feugiat diam, id feugiat eros faucibus eget. Donec viverra dolor vel justo scelerisque dignissim. Nulla semper sem nunc, rhoncus semper tellus ultricies sed. Duis in ornare diam. Donec vehicula feugiat varius. Maecenas ut suscipit est. Vivamus sem sem, finibus at dolor sit amet, euismod dapibus ligula. Vestibulum fringilla odio dapibus, congue massa eget, congue sem. Donec feugiat magna eget tortor lacinia scelerisque non et ipsum.
Suspendisse potenti. Nunc convallis sollicitudin ex eget venenatis. Sed iaculis nibh ex, vel ornare ligula congue dignissim. Quisque sollicitudin dolor ac dui vestibulum, sit amet molestie nisi aliquet. Donec at risus felis. Aenean sollicitudin metus a feugiat porta. Aenean a tortor ut dolor cursus sagittis. Vivamus consectetur porttitor nunc in facilisis. Proin sit amet mi vel lectus consectetur ultrices.
Sed cursus lectus vitae nunc tristique, nec commodo turpis dapibus. Pellentesque luctus ex id facilisis ornare. Morbi quis placerat dolor. Donec in lectus in arcu mattis porttitor ac sit amet metus. Cras congue mauris non risus sodales, vitae feugiat ipsum bibendum. Nulla venenatis urna sed libero elementum, a cursus lorem commodo. Mauris faucibus lobortis eros nec commodo.
Nullam suscipit ligula ullamcorper lorem commodo blandit. Nulla porta nibh quis pulvinar placerat. Vivamus eu arcu justo. Vestibulum imperdiet est ut fermentum porttitor. Pellentesque consectetur libero in sapien efficitur scelerisque. Curabitur ac erat sit amet odio aliquet dignissim. Pellentesque mi sem, rhoncus et luctus at, porttitor rutrum lectus. Vestibulum sollicitudin sollicitudin suscipit. Aenean efficitur dolor non ultrices imperdiet. Donec vel sem ex.
Sed convallis mauris aliquam rutrum cursus. Ut tempor porttitor sodales. Etiam eu risus ac augue gravida egestas et eu dolor. Proin id magna ex. Suspendisse quis lectus quis lorem ultricies tempus. Donec porttitor velit vitae tincidunt faucibus. Aliquam vitae semper nisi. Morbi ultrices, leo non pretium dapibus, dui libero pellentesque ex, vel placerat enim ante vitae dui. Nunc varius, sem sit amet sagittis lobortis, lectus odio scelerisque mauris, ut vestibulum orci magna quis neque. Sed id congue justo. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris congue nisi est, malesuada mollis elit tincidunt sed. Curabitur sed ex sit amet felis tristique elementum vitae vel nibh.
Etiam mollis pretium lobortis. Mauris augue lacus, efficitur at lacus sed, mollis tincidunt lectus. Aliquam erat volutpat. Donec at euismod elit, et mattis felis. Sed id lobortis urna. Morbi imperdiet vestibulum leo, sed maximus leo blandit eu. Aliquam semper lorem neque, nec euismod turpis mattis mollis. Quisque lobortis urna ultrices odio pretium, ac venenatis orci faucibus. Suspendisse bibendum odio ligula, sed lobortis massa pharetra nec. Donec turpis justo, iaculis at dictum ac, finibus eu libero. Maecenas quis porttitor mi, sit amet aliquet neque.
Vivamus auctor vulputate ante, at egestas lorem. Donec eu risus in nulla mollis ultricies at et urna. Duis accumsan porta egestas. Ut vel euismod augue. Fusce convallis nulla ante, nec fringilla velit aliquet at. Nam malesuada dapibus ligula, a aliquam nibh scelerisque ac. Praesent malesuada neque et pellentesque interdum. Curabitur volutpat at turpis vitae tristique. Vivamus porttitor semper congue. Quisque suscipit lacus mi, rhoncus ultrices tortor auctor quis. Maecenas neque neque, molestie ac facilisis eget, luctus ac lorem. In ut odio ut lacus suscipit pulvinar vitae sed elit. Nulla imperdiet, sem quis euismod sagittis, dui erat luctus dolor, faucibus faucibus erat sem eget nunc. Nam accumsan placerat malesuada. Maecenas convallis finibus pulvinar.
Cras at placerat tortor. Morbi facilisis auctor felis sit amet molestie. Donec sodales sed lorem vitae suscipit. Etiam fermentum pharetra ipsum, nec luctus orci gravida eu. Pellentesque gravida, est non condimentum tempus, mauris ligula molestie est, in congue dolor nisl vel sapien. Duis congue tempor augue, id rutrum eros porta dapibus. Etiam rutrum eget est eget vestibulum. Aenean mollis arcu vel consequat varius. Praesent at condimentum felis. Duis nec interdum nisl. Donec commodo lorem sed sapien scelerisque malesuada non eu urna. In blandit non ipsum at porta. Nam lobortis leo vitae dui auctor, non feugiat quam bibendum. Donec auctor lectus sagittis laoreet maximus. Maecenas rhoncus laoreet porttitor. Vestibulum porttitor augue ut lectus hendrerit, eget posuere mi gravida.
Sed mattis ex in erat pulvinar, eu imperdiet magna dapibus. Etiam nisi nibh, tempus non tellus sit amet, mattis tempor odio. Quisque nec lorem feugiat, lobortis odio et, commodo nunc. Maecenas semper purus nisi, nec vehicula nibh eleifend vitae. Nulla fermentum a lectus at maximus. Phasellus finibus metus non euismod ultrices. Etiam a pulvinar ante. Quisque convallis nec metus sit amet facilisis. Praesent laoreet massa et sollicitudin laoreet. Vestibulum in mauris aliquet, convallis mi ut, elementum purus. Nulla purus nulla, sodales at hendrerit quis, tempus sed lectus.
Nam ut laoreet neque, ut maximus nibh. Maecenas quis justo pellentesque, sollicitudin elit at, venenatis velit. Aenean nunc velit, vehicula scelerisque odio at, consectetur laoreet purus. Duis dui purus, malesuada quis ipsum sit amet, tempor interdum libero. Curabitur porta scelerisque sapien, vitae cursus diam condimentum eu. Phasellus sed orci quam. Nullam vitae dui quis purus tincidunt vestibulum. Curabitur quis nulla porta, cursus arcu non, auctor enim. Etiam sollicitudin ex id sem vehicula mollis. Morbi viverra laoreet tincidunt. Praesent ut semper dui. Nam sit amet pretium neque. Mauris vitae luctus diam, in lacinia purus. Maecenas ut placerat justo, ut porta felis. Integer eu mauris ante.
Aenean porttitor tellus diam, tempor consequat metus efficitur id. Suspendisse ut felis at erat tempor dictum at nec sapien. Sed vestibulum interdum felis, ac mattis mauris porta in. Nunc et condimentum massa. Sed cursus dictum justo et luctus. Integer convallis enim nisl, a rutrum lectus ultricies in. Donec dapibus lacus at nulla dapibus, id sollicitudin velit hendrerit. Fusce a magna at orci mollis rutrum ac a dolor. Aliquam erat volutpat. Morbi varius porta nunc, sit amet sodales ex hendrerit commodo. Donec tincidunt tortor sapien, vitae egestas sapien vehicula eget.
Suspendisse potenti. Donec pulvinar felis nec leo malesuada interdum. Integer posuere placerat maximus. Donec nibh ipsum, tincidunt vitae luctus vitae, bibendum at leo. Sed cursus nisl ut ex faucibus aliquet sed nec eros. Curabitur molestie posuere felis. Integer faucibus velit eget consequat iaculis. Mauris sed vulputate odio. Phasellus maximus, elit a pharetra egestas, lorem magna semper tellus, vestibulum semper diam felis at sapien. Suspendisse facilisis, nisl sit amet euismod vehicula, libero nulla vehicula dolor, quis fermentum nibh elit sit amet diam.
Morbi lorem enim, euismod eu varius ut, scelerisque quis odio. Nam tempus vitae eros id molestie. Nunc pretium in nulla eget accumsan. Quisque mattis est ut semper aliquet. Maecenas eget diam elementum, fermentum ipsum a, euismod sapien. Duis quam ligula, cursus et velit nec, ullamcorper tincidunt magna. Donec vulputate nisl est, et ullamcorper urna tempor sit amet.
Proin lacinia dui non turpis congue pretium. Morbi posuere metus vel purus imperdiet interdum. Morbi venenatis vel eros non ultricies. Nulla vel semper elit. Ut quis purus tincidunt, auctor justo ut, faucibus turpis. Proin quis mattis erat, at faucibus ligula. Mauris in mauris enim. Donec facilisis enim at est feugiat hendrerit. Nam vel nisi lorem. Fusce ultricies convallis diam, in feugiat tortor luctus quis. Donec tempor, leo vitae volutpat aliquam, magna elit feugiat leo, quis placerat sapien felis eget arcu. Donec ornare fermentum eleifend. Integer a est orci.
Proin rhoncus egestas leo. Nulla ultricies porta elit quis ornare. Nunc fermentum interdum vehicula. In in ligula lorem. Donec nec arcu sit amet orci lobortis iaculis. Mauris at mollis erat, sit amet mollis tortor. Mauris laoreet justo ullamcorper porttitor auctor. Aenean sit amet aliquam lectus, id fermentum eros. Praesent urna sem, vehicula ac fermentum id, dapibus ut purus. Vestibulum vitae tempus nunc. Donec at nunc ornare metus volutpat porta at eget magna. Donec varius aliquet metus, eu lobortis risus aliquam sed. Ut dapibus fermentum velit, ac tincidunt libero faucibus at.
In in purus auctor, feugiat massa quis, facilisis nisi. Donec dolor purus, gravida eget dolor ac, porttitor imperdiet urna. Donec faucibus placerat erat, a sagittis ante finibus ac. Sed venenatis dignissim elit, in iaculis felis posuere faucibus. Praesent sed viverra dolor. Mauris sed nulla consectetur nunc laoreet molestie in ut metus. Proin ac ex sit amet magna vulputate hendrerit ac condimentum urna. Proin ligula metus, gravida et sollicitudin facilisis, iaculis ut odio. Cras tincidunt urna et augue varius, ut facilisis urna consequat. Aenean vehicula finibus quam. Ut iaculis eu diam ac mollis. Nam mi lorem, tristique eget varius at, sodales at urna.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin vitae dictum erat, et auctor ipsum. Nullam nunc nunc, sollicitudin quis magna a, vestibulum fermentum mauris. Praesent at erat dolor. Proin laoreet tristique nulla vel efficitur. Nam sed ultrices nibh, id rutrum nunc. Curabitur eleifend a erat sit amet sollicitudin. Nullam metus quam, laoreet vitae dapibus id, placerat sed leo. Aliquam erat volutpat. Donec turpis nisl, cursus eu ex sit amet, lacinia pellentesque nisl. Sed id ipsum massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec interdum scelerisque lorem eu mattis.
Vivamus ac tristique massa, nec facilisis nisl. Nam ipsum neque, tincidunt vel urna in, cursus imperdiet enim. Nam pellentesque egestas tempus. Morbi facilisis imperdiet libero vitae fringilla. Nam lacinia ligula at sapien facilisis malesuada. Nullam accumsan pulvinar sem, et cursus libero porta sit amet. Curabitur vulputate erat elit, ut pulvinar erat maximus vel.
Cras aliquet metus ut purus sagittis, vel venenatis ante consectetur. Pellentesque nulla lacus, viverra viverra mattis non, placerat vitae nibh. Donec enim turpis, accumsan sit amet tincidunt eu, imperdiet non metus. Morbi ipsum eros, tincidunt vel est ac, tristique porttitor nibh. Praesent ut ullamcorper mauris. Sed laoreet sit amet diam congue venenatis. Integer porta purus nec orci sagittis posuere.
Donec vehicula mauris eget lacus mollis venenatis et sed nibh. Nam sodales ligula ipsum, scelerisque lacinia ligula sagittis in. Nam sit amet ipsum at erat malesuada congue. Aenean ut sollicitudin sapien. Etiam at tempor odio. Mauris vitae purus ut magna suscipit consequat. Vivamus quis sapien neque. Nulla vulputate sem sit amet massa pellentesque, eleifend tristique ligula egestas. Suspendisse tincidunt gravida mi, in pulvinar lectus egestas non. Aenean imperdiet ex sit amet nunc sollicitudin porta. Integer justo odio, ultricies at interdum in, rhoncus vitae sem. Sed porttitor arcu quis purus aliquet hendrerit. Praesent tempor tortor at dolor dictum pulvinar. Nulla aliquet nunc non ligula scelerisque accumsan. Donec nulla justo, congue vitae massa in, faucibus hendrerit magna. Donec non egestas purus.
`),
tail: VSBuffer.fromString(`Vivamus iaculis, lacus efficitur faucibus porta, dui nulla facilisis ligula, ut sodales odio nunc id sapien. Cras viverra auctor ipsum, dapibus mattis neque dictum sed. Sed convallis fermentum molestie. Nulla facilisi turpis duis.`)
};
}
| src/vs/workbench/services/textfile/test/browser/fixtures/files.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00023164378944784403,
0.000171067236806266,
0.00016375268751289696,
0.0001673405058681965,
0.000011563498446776066
]
|
{
"id": 3,
"code_window": [
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.externalFileGlobs\": {\n",
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.externalFileGlobs\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 537
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9043604731559753,
0.01448780857026577,
0.0001640058180782944,
0.0001851805136539042,
0.11211659014225006
]
|
{
"id": 3,
"code_window": [
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.externalFileGlobs\": {\n",
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.externalFileGlobs\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 537
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { $, append, hide, show } from 'vs/base/browser/dom';
import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IListRenderer } from 'vs/base/browser/ui/list/list';
import { Codicon, CSSIcon } from 'vs/base/common/codicons';
import { Emitter, Event } from 'vs/base/common/event';
import { createMatches } from 'vs/base/common/filters';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { CompletionItemKind, CompletionItemKinds, CompletionItemTag } from 'vs/editor/common/languages';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { IModelService } from 'vs/editor/common/services/model';
import { ILanguageService } from 'vs/editor/common/languages/language';
import * as nls from 'vs/nls';
import { FileKind } from 'vs/platform/files/common/files';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { CompletionItem } from './suggest';
import { canExpandCompletionItem } from './suggestWidgetDetails';
export function getAriaId(index: number): string {
return `suggest-aria-id:${index}`;
}
export const suggestMoreInfoIcon = registerIcon('suggest-more-info', Codicon.chevronRight, nls.localize('suggestMoreInfoIcon', 'Icon for more information in the suggest widget.'));
const _completionItemColor = new class ColorExtractor {
private static _regexRelaxed = /(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/;
private static _regexStrict = new RegExp(`^${ColorExtractor._regexRelaxed.source}$`, 'i');
extract(item: CompletionItem, out: string[]): boolean {
if (item.textLabel.match(ColorExtractor._regexStrict)) {
out[0] = item.textLabel;
return true;
}
if (item.completion.detail && item.completion.detail.match(ColorExtractor._regexStrict)) {
out[0] = item.completion.detail;
return true;
}
if (typeof item.completion.documentation === 'string') {
const match = ColorExtractor._regexRelaxed.exec(item.completion.documentation);
if (match && (match.index === 0 || match.index + match[0].length === item.completion.documentation.length)) {
out[0] = match[0];
return true;
}
}
return false;
}
};
export interface ISuggestionTemplateData {
root: HTMLElement;
/**
* Flexbox
* < ------------- left ------------ > < --- right -- >
* <icon><label><signature><qualifier> <type><readmore>
*/
left: HTMLElement;
right: HTMLElement;
icon: HTMLElement;
colorspan: HTMLElement;
iconLabel: IconLabel;
iconContainer: HTMLElement;
parametersLabel: HTMLElement;
qualifierLabel: HTMLElement;
/**
* Showing either `CompletionItem#details` or `CompletionItemLabel#type`
*/
detailsLabel: HTMLElement;
readMore: HTMLElement;
disposables: DisposableStore;
}
export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateData> {
private readonly _onDidToggleDetails = new Emitter<void>();
readonly onDidToggleDetails: Event<void> = this._onDidToggleDetails.event;
readonly templateId = 'suggestion';
constructor(
private readonly _editor: ICodeEditor,
@IModelService private readonly _modelService: IModelService,
@ILanguageService private readonly _languageService: ILanguageService,
@IThemeService private readonly _themeService: IThemeService
) { }
dispose(): void {
this._onDidToggleDetails.dispose();
}
renderTemplate(container: HTMLElement): ISuggestionTemplateData {
const data = <ISuggestionTemplateData>Object.create(null);
data.disposables = new DisposableStore();
data.root = container;
data.root.classList.add('show-file-icons');
data.icon = append(container, $('.icon'));
data.colorspan = append(data.icon, $('span.colorspan'));
const text = append(container, $('.contents'));
const main = append(text, $('.main'));
data.iconContainer = append(main, $('.icon-label.codicon'));
data.left = append(main, $('span.left'));
data.right = append(main, $('span.right'));
data.iconLabel = new IconLabel(data.left, { supportHighlights: true, supportIcons: true });
data.disposables.add(data.iconLabel);
data.parametersLabel = append(data.left, $('span.signature-label'));
data.qualifierLabel = append(data.left, $('span.qualifier-label'));
data.detailsLabel = append(data.right, $('span.details-label'));
data.readMore = append(data.right, $('span.readMore' + ThemeIcon.asCSSSelector(suggestMoreInfoIcon)));
data.readMore.title = nls.localize('readMore', "Read More");
const configureFont = () => {
const options = this._editor.getOptions();
const fontInfo = options.get(EditorOption.fontInfo);
const fontFamily = fontInfo.getMassagedFontFamily();
const fontFeatureSettings = fontInfo.fontFeatureSettings;
const fontSize = options.get(EditorOption.suggestFontSize) || fontInfo.fontSize;
const lineHeight = options.get(EditorOption.suggestLineHeight) || fontInfo.lineHeight;
const fontWeight = fontInfo.fontWeight;
const letterSpacing = fontInfo.letterSpacing;
const fontSizePx = `${fontSize}px`;
const lineHeightPx = `${lineHeight}px`;
const letterSpacingPx = `${letterSpacing}px`;
data.root.style.fontSize = fontSizePx;
data.root.style.fontWeight = fontWeight;
data.root.style.letterSpacing = letterSpacingPx;
main.style.fontFamily = fontFamily;
main.style.fontFeatureSettings = fontFeatureSettings;
main.style.lineHeight = lineHeightPx;
data.icon.style.height = lineHeightPx;
data.icon.style.width = lineHeightPx;
data.readMore.style.height = lineHeightPx;
data.readMore.style.width = lineHeightPx;
};
configureFont();
data.disposables.add(this._editor.onDidChangeConfiguration(e => {
if (e.hasChanged(EditorOption.fontInfo) || e.hasChanged(EditorOption.suggestFontSize) || e.hasChanged(EditorOption.suggestLineHeight)) {
configureFont();
}
}));
return data;
}
renderElement(element: CompletionItem, index: number, data: ISuggestionTemplateData): void {
const { completion } = element;
data.root.id = getAriaId(index);
data.colorspan.style.backgroundColor = '';
const labelOptions: IIconLabelValueOptions = {
labelEscapeNewLines: true,
matches: createMatches(element.score)
};
const color: string[] = [];
if (completion.kind === CompletionItemKind.Color && _completionItemColor.extract(element, color)) {
// special logic for 'color' completion items
data.icon.className = 'icon customcolor';
data.iconContainer.className = 'icon hide';
data.colorspan.style.backgroundColor = color[0];
} else if (completion.kind === CompletionItemKind.File && this._themeService.getFileIconTheme().hasFileIcons) {
// special logic for 'file' completion items
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
const labelClasses = getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FILE);
const detailClasses = getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FILE);
labelOptions.extraClasses = labelClasses.length > detailClasses.length ? labelClasses : detailClasses;
} else if (completion.kind === CompletionItemKind.Folder && this._themeService.getFileIconTheme().hasFolderIcons) {
// special logic for 'folder' completion items
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
labelOptions.extraClasses = [
getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FOLDER),
getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FOLDER)
].flat();
} else {
// normal icon
data.icon.className = 'icon hide';
data.iconContainer.className = '';
data.iconContainer.classList.add('suggest-icon', ...CSSIcon.asClassNameArray(CompletionItemKinds.toIcon(completion.kind)));
}
if (completion.tags && completion.tags.indexOf(CompletionItemTag.Deprecated) >= 0) {
labelOptions.extraClasses = (labelOptions.extraClasses || []).concat(['deprecated']);
labelOptions.matches = [];
}
data.iconLabel.setLabel(element.textLabel, undefined, labelOptions);
if (typeof completion.label === 'string') {
data.parametersLabel.textContent = '';
data.detailsLabel.textContent = stripNewLines(completion.detail || '');
data.root.classList.add('string-label');
} else {
data.parametersLabel.textContent = stripNewLines(completion.label.detail || '');
data.detailsLabel.textContent = stripNewLines(completion.label.description || '');
data.root.classList.remove('string-label');
}
if (this._editor.getOption(EditorOption.suggest).showInlineDetails) {
show(data.detailsLabel);
} else {
hide(data.detailsLabel);
}
if (canExpandCompletionItem(element)) {
data.right.classList.add('can-expand-details');
show(data.readMore);
data.readMore.onmousedown = e => {
e.stopPropagation();
e.preventDefault();
};
data.readMore.onclick = e => {
e.stopPropagation();
e.preventDefault();
this._onDidToggleDetails.fire();
};
} else {
data.right.classList.remove('can-expand-details');
hide(data.readMore);
data.readMore.onmousedown = null;
data.readMore.onclick = null;
}
}
disposeTemplate(templateData: ISuggestionTemplateData): void {
templateData.disposables.dispose();
}
}
function stripNewLines(str: string): string {
return str.replace(/\r\n|\r|\n/g, '');
}
| src/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001749977673171088,
0.0001701408182270825,
0.00016633795166853815,
0.00017045716231223196,
0.0000021805371943628415
]
|
{
"id": 3,
"code_window": [
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.externalFileGlobs\": {\n",
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.externalFileGlobs\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 537
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { transformErrorForSerialization } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { getAllMethodNames } from 'vs/base/common/objects';
import { globals, isWeb } from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
const INITIALIZE = '$initialize';
export interface IWorker extends IDisposable {
getId(): number;
postMessage(message: Message, transfer: ArrayBuffer[]): void;
}
export interface IWorkerCallback {
(message: Message): void;
}
export interface IWorkerFactory {
create(moduleId: string, callback: IWorkerCallback, onErrorCallback: (err: any) => void): IWorker;
}
let webWorkerWarningLogged = false;
export function logOnceWebWorkerWarning(err: any): void {
if (!isWeb) {
// running tests
return;
}
if (!webWorkerWarningLogged) {
webWorkerWarningLogged = true;
console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq');
}
console.warn(err.message);
}
const enum MessageType {
Request,
Reply,
SubscribeEvent,
Event,
UnsubscribeEvent
}
class RequestMessage {
public readonly type = MessageType.Request;
constructor(
public readonly vsWorker: number,
public readonly req: string,
public readonly method: string,
public readonly args: any[]
) { }
}
class ReplyMessage {
public readonly type = MessageType.Reply;
constructor(
public readonly vsWorker: number,
public readonly seq: string,
public readonly res: any,
public readonly err: any
) { }
}
class SubscribeEventMessage {
public readonly type = MessageType.SubscribeEvent;
constructor(
public readonly vsWorker: number,
public readonly req: string,
public readonly eventName: string,
public readonly arg: any
) { }
}
class EventMessage {
public readonly type = MessageType.Event;
constructor(
public readonly vsWorker: number,
public readonly req: string,
public readonly event: any
) { }
}
class UnsubscribeEventMessage {
public readonly type = MessageType.UnsubscribeEvent;
constructor(
public readonly vsWorker: number,
public readonly req: string
) { }
}
type Message = RequestMessage | ReplyMessage | SubscribeEventMessage | EventMessage | UnsubscribeEventMessage;
interface IMessageReply {
resolve: (value?: any) => void;
reject: (error?: any) => void;
}
interface IMessageHandler {
sendMessage(msg: any, transfer?: ArrayBuffer[]): void;
handleMessage(method: string, args: any[]): Promise<any>;
handleEvent(eventName: string, arg: any): Event<any>;
}
class SimpleWorkerProtocol {
private _workerId: number;
private _lastSentReq: number;
private _pendingReplies: { [req: string]: IMessageReply };
private _pendingEmitters: Map<string, Emitter<any>>;
private _pendingEvents: Map<string, IDisposable>;
private _handler: IMessageHandler;
constructor(handler: IMessageHandler) {
this._workerId = -1;
this._handler = handler;
this._lastSentReq = 0;
this._pendingReplies = Object.create(null);
this._pendingEmitters = new Map<string, Emitter<any>>();
this._pendingEvents = new Map<string, IDisposable>();
}
public setWorkerId(workerId: number): void {
this._workerId = workerId;
}
public sendMessage(method: string, args: any[]): Promise<any> {
const req = String(++this._lastSentReq);
return new Promise<any>((resolve, reject) => {
this._pendingReplies[req] = {
resolve: resolve,
reject: reject
};
this._send(new RequestMessage(this._workerId, req, method, args));
});
}
public listen(eventName: string, arg: any): Event<any> {
let req: string | null = null;
const emitter = new Emitter<any>({
onFirstListenerAdd: () => {
req = String(++this._lastSentReq);
this._pendingEmitters.set(req, emitter);
this._send(new SubscribeEventMessage(this._workerId, req, eventName, arg));
},
onLastListenerRemove: () => {
this._pendingEmitters.delete(req!);
this._send(new UnsubscribeEventMessage(this._workerId, req!));
req = null;
}
});
return emitter.event;
}
public handleMessage(message: Message): void {
if (!message || !message.vsWorker) {
return;
}
if (this._workerId !== -1 && message.vsWorker !== this._workerId) {
return;
}
this._handleMessage(message);
}
private _handleMessage(msg: Message): void {
switch (msg.type) {
case MessageType.Reply:
return this._handleReplyMessage(msg);
case MessageType.Request:
return this._handleRequestMessage(msg);
case MessageType.SubscribeEvent:
return this._handleSubscribeEventMessage(msg);
case MessageType.Event:
return this._handleEventMessage(msg);
case MessageType.UnsubscribeEvent:
return this._handleUnsubscribeEventMessage(msg);
}
}
private _handleReplyMessage(replyMessage: ReplyMessage): void {
if (!this._pendingReplies[replyMessage.seq]) {
console.warn('Got reply to unknown seq');
return;
}
const reply = this._pendingReplies[replyMessage.seq];
delete this._pendingReplies[replyMessage.seq];
if (replyMessage.err) {
let err = replyMessage.err;
if (replyMessage.err.$isError) {
err = new Error();
err.name = replyMessage.err.name;
err.message = replyMessage.err.message;
err.stack = replyMessage.err.stack;
}
reply.reject(err);
return;
}
reply.resolve(replyMessage.res);
}
private _handleRequestMessage(requestMessage: RequestMessage): void {
const req = requestMessage.req;
const result = this._handler.handleMessage(requestMessage.method, requestMessage.args);
result.then((r) => {
this._send(new ReplyMessage(this._workerId, req, r, undefined));
}, (e) => {
if (e.detail instanceof Error) {
// Loading errors have a detail property that points to the actual error
e.detail = transformErrorForSerialization(e.detail);
}
this._send(new ReplyMessage(this._workerId, req, undefined, transformErrorForSerialization(e)));
});
}
private _handleSubscribeEventMessage(msg: SubscribeEventMessage): void {
const req = msg.req;
const disposable = this._handler.handleEvent(msg.eventName, msg.arg)((event) => {
this._send(new EventMessage(this._workerId, req, event));
});
this._pendingEvents.set(req, disposable);
}
private _handleEventMessage(msg: EventMessage): void {
if (!this._pendingEmitters.has(msg.req)) {
console.warn('Got event for unknown req');
return;
}
this._pendingEmitters.get(msg.req)!.fire(msg.event);
}
private _handleUnsubscribeEventMessage(msg: UnsubscribeEventMessage): void {
if (!this._pendingEvents.has(msg.req)) {
console.warn('Got unsubscribe for unknown req');
return;
}
this._pendingEvents.get(msg.req)!.dispose();
this._pendingEvents.delete(msg.req);
}
private _send(msg: Message): void {
const transfer: ArrayBuffer[] = [];
if (msg.type === MessageType.Request) {
for (let i = 0; i < msg.args.length; i++) {
if (msg.args[i] instanceof ArrayBuffer) {
transfer.push(msg.args[i]);
}
}
} else if (msg.type === MessageType.Reply) {
if (msg.res instanceof ArrayBuffer) {
transfer.push(msg.res);
}
}
this._handler.sendMessage(msg, transfer);
}
}
export interface IWorkerClient<W> {
getProxyObject(): Promise<W>;
dispose(): void;
}
/**
* Main thread side
*/
export class SimpleWorkerClient<W extends object, H extends object> extends Disposable implements IWorkerClient<W> {
private readonly _worker: IWorker;
private readonly _onModuleLoaded: Promise<string[]>;
private readonly _protocol: SimpleWorkerProtocol;
private readonly _lazyProxy: Promise<W>;
constructor(workerFactory: IWorkerFactory, moduleId: string, host: H) {
super();
let lazyProxyReject: ((err: any) => void) | null = null;
this._worker = this._register(workerFactory.create(
'vs/base/common/worker/simpleWorker',
(msg: Message) => {
this._protocol.handleMessage(msg);
},
(err: any) => {
// in Firefox, web workers fail lazily :(
// we will reject the proxy
lazyProxyReject?.(err);
}
));
this._protocol = new SimpleWorkerProtocol({
sendMessage: (msg: any, transfer: ArrayBuffer[]): void => {
this._worker.postMessage(msg, transfer);
},
handleMessage: (method: string, args: any[]): Promise<any> => {
if (typeof (host as any)[method] !== 'function') {
return Promise.reject(new Error('Missing method ' + method + ' on main thread host.'));
}
try {
return Promise.resolve((host as any)[method].apply(host, args));
} catch (e) {
return Promise.reject(e);
}
},
handleEvent: (eventName: string, arg: any): Event<any> => {
if (propertyIsDynamicEvent(eventName)) {
const event = (host as any)[eventName].call(host, arg);
if (typeof event !== 'function') {
throw new Error(`Missing dynamic event ${eventName} on main thread host.`);
}
return event;
}
if (propertyIsEvent(eventName)) {
const event = (host as any)[eventName];
if (typeof event !== 'function') {
throw new Error(`Missing event ${eventName} on main thread host.`);
}
return event;
}
throw new Error(`Malformed event name ${eventName}`);
}
});
this._protocol.setWorkerId(this._worker.getId());
// Gather loader configuration
let loaderConfiguration: any = null;
if (typeof globals.require !== 'undefined' && typeof globals.require.getConfig === 'function') {
// Get the configuration from the Monaco AMD Loader
loaderConfiguration = globals.require.getConfig();
} else if (typeof globals.requirejs !== 'undefined') {
// Get the configuration from requirejs
loaderConfiguration = globals.requirejs.s.contexts._.config;
}
const hostMethods = getAllMethodNames(host);
// Send initialize message
this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [
this._worker.getId(),
JSON.parse(JSON.stringify(loaderConfiguration)),
moduleId,
hostMethods,
]);
// Create proxy to loaded code
const proxyMethodRequest = (method: string, args: any[]): Promise<any> => {
return this._request(method, args);
};
const proxyListen = (eventName: string, arg: any): Event<any> => {
return this._protocol.listen(eventName, arg);
};
this._lazyProxy = new Promise<W>((resolve, reject) => {
lazyProxyReject = reject;
this._onModuleLoaded.then((availableMethods: string[]) => {
resolve(createProxyObject<W>(availableMethods, proxyMethodRequest, proxyListen));
}, (e) => {
reject(e);
this._onError('Worker failed to load ' + moduleId, e);
});
});
}
public getProxyObject(): Promise<W> {
return this._lazyProxy;
}
private _request(method: string, args: any[]): Promise<any> {
return new Promise<any>((resolve, reject) => {
this._onModuleLoaded.then(() => {
this._protocol.sendMessage(method, args).then(resolve, reject);
}, reject);
});
}
private _onError(message: string, error?: any): void {
console.error(message);
console.info(error);
}
}
function propertyIsEvent(name: string): boolean {
// Assume a property is an event if it has a form of "onSomething"
return name[0] === 'o' && name[1] === 'n' && strings.isUpperAsciiLetter(name.charCodeAt(2));
}
function propertyIsDynamicEvent(name: string): boolean {
// Assume a property is a dynamic event (a method that returns an event) if it has a form of "onDynamicSomething"
return /^onDynamic/.test(name) && strings.isUpperAsciiLetter(name.charCodeAt(9));
}
function createProxyObject<T extends object>(
methodNames: string[],
invoke: (method: string, args: unknown[]) => unknown,
proxyListen: (eventName: string, arg: any) => Event<any>
): T {
const createProxyMethod = (method: string): () => unknown => {
return function () {
const args = Array.prototype.slice.call(arguments, 0);
return invoke(method, args);
};
};
const createProxyDynamicEvent = (eventName: string): (arg: any) => Event<any> => {
return function (arg) {
return proxyListen(eventName, arg);
};
};
const result = {} as T;
for (const methodName of methodNames) {
if (propertyIsDynamicEvent(methodName)) {
(<any>result)[methodName] = createProxyDynamicEvent(methodName);
continue;
}
if (propertyIsEvent(methodName)) {
(<any>result)[methodName] = proxyListen(methodName, undefined);
continue;
}
(<any>result)[methodName] = createProxyMethod(methodName);
}
return result;
}
export interface IRequestHandler {
_requestHandlerBrand: any;
[prop: string]: any;
}
export interface IRequestHandlerFactory<H> {
(host: H): IRequestHandler;
}
/**
* Worker side
*/
export class SimpleWorkerServer<H extends object> {
private _requestHandlerFactory: IRequestHandlerFactory<H> | null;
private _requestHandler: IRequestHandler | null;
private _protocol: SimpleWorkerProtocol;
constructor(postMessage: (msg: Message, transfer?: ArrayBuffer[]) => void, requestHandlerFactory: IRequestHandlerFactory<H> | null) {
this._requestHandlerFactory = requestHandlerFactory;
this._requestHandler = null;
this._protocol = new SimpleWorkerProtocol({
sendMessage: (msg: any, transfer: ArrayBuffer[]): void => {
postMessage(msg, transfer);
},
handleMessage: (method: string, args: any[]): Promise<any> => this._handleMessage(method, args),
handleEvent: (eventName: string, arg: any): Event<any> => this._handleEvent(eventName, arg)
});
}
public onmessage(msg: any): void {
this._protocol.handleMessage(msg);
}
private _handleMessage(method: string, args: any[]): Promise<any> {
if (method === INITIALIZE) {
return this.initialize(<number>args[0], <any>args[1], <string>args[2], <string[]>args[3]);
}
if (!this._requestHandler || typeof this._requestHandler[method] !== 'function') {
return Promise.reject(new Error('Missing requestHandler or method: ' + method));
}
try {
return Promise.resolve(this._requestHandler[method].apply(this._requestHandler, args));
} catch (e) {
return Promise.reject(e);
}
}
private _handleEvent(eventName: string, arg: any): Event<any> {
if (!this._requestHandler) {
throw new Error(`Missing requestHandler`);
}
if (propertyIsDynamicEvent(eventName)) {
const event = (this._requestHandler as any)[eventName].call(this._requestHandler, arg);
if (typeof event !== 'function') {
throw new Error(`Missing dynamic event ${eventName} on request handler.`);
}
return event;
}
if (propertyIsEvent(eventName)) {
const event = (this._requestHandler as any)[eventName];
if (typeof event !== 'function') {
throw new Error(`Missing event ${eventName} on request handler.`);
}
return event;
}
throw new Error(`Malformed event name ${eventName}`);
}
private initialize(workerId: number, loaderConfig: any, moduleId: string, hostMethods: string[]): Promise<string[]> {
this._protocol.setWorkerId(workerId);
const proxyMethodRequest = (method: string, args: any[]): Promise<any> => {
return this._protocol.sendMessage(method, args);
};
const proxyListen = (eventName: string, arg: any): Event<any> => {
return this._protocol.listen(eventName, arg);
};
const hostProxy = createProxyObject<H>(hostMethods, proxyMethodRequest, proxyListen);
if (this._requestHandlerFactory) {
// static request handler
this._requestHandler = this._requestHandlerFactory(hostProxy);
return Promise.resolve(getAllMethodNames(this._requestHandler));
}
if (loaderConfig) {
// Remove 'baseUrl', handling it is beyond scope for now
if (typeof loaderConfig.baseUrl !== 'undefined') {
delete loaderConfig['baseUrl'];
}
if (typeof loaderConfig.paths !== 'undefined') {
if (typeof loaderConfig.paths.vs !== 'undefined') {
delete loaderConfig.paths['vs'];
}
}
if (typeof loaderConfig.trustedTypesPolicy !== undefined) {
// don't use, it has been destroyed during serialize
delete loaderConfig['trustedTypesPolicy'];
}
// Since this is in a web worker, enable catching errors
loaderConfig.catchError = true;
globals.require.config(loaderConfig);
}
return new Promise<string[]>((resolve, reject) => {
// Use the global require to be sure to get the global config
// ESM-comment-begin
const req = (globals.require || require);
// ESM-comment-end
// ESM-uncomment-begin
// const req = globals.require;
// ESM-uncomment-end
req([moduleId], (module: { create: IRequestHandlerFactory<H> }) => {
this._requestHandler = module.create(hostProxy);
if (!this._requestHandler) {
reject(new Error(`No RequestHandler!`));
return;
}
resolve(getAllMethodNames(this._requestHandler));
}, reject);
});
}
}
/**
* Called on the worker side
*/
export function create(postMessage: (msg: Message, transfer?: ArrayBuffer[]) => void): SimpleWorkerServer<any> {
return new SimpleWorkerServer(postMessage, null);
}
| src/vs/base/common/worker/simpleWorker.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0003425017057452351,
0.00017347568063996732,
0.00016227092419285327,
0.00016804388724267483,
0.00003020674739673268
]
|
{
"id": 3,
"code_window": [
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.externalFileGlobs\": {\n",
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.externalFileGlobs\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 537
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/59921
/**
* The parameters of a query for text search.
*/
export interface TextSearchQuery {
/**
* The text pattern to search for.
*/
pattern: string;
/**
* Whether or not `pattern` should match multiple lines of text.
*/
isMultiline?: boolean;
/**
* Whether or not `pattern` should be interpreted as a regular expression.
*/
isRegExp?: boolean;
/**
* Whether or not the search should be case-sensitive.
*/
isCaseSensitive?: boolean;
/**
* Whether or not to search for whole word matches only.
*/
isWordMatch?: boolean;
}
/**
* A file glob pattern to match file paths against.
* TODO@roblourens merge this with the GlobPattern docs/definition in vscode.d.ts.
* @see {@link GlobPattern}
*/
export type GlobString = string;
/**
* Options common to file and text search
*/
export interface SearchOptions {
/**
* The root folder to search within.
*/
folder: Uri;
/**
* Files that match an `includes` glob pattern should be included in the search.
*/
includes: GlobString[];
/**
* Files that match an `excludes` glob pattern should be excluded from the search.
*/
excludes: GlobString[];
/**
* Whether external files that exclude files, like .gitignore, should be respected.
* See the vscode setting `"search.useIgnoreFiles"`.
*/
useIgnoreFiles: boolean;
/**
* Whether symlinks should be followed while searching.
* See the vscode setting `"search.followSymlinks"`.
*/
followSymlinks: boolean;
/**
* Whether global files that exclude files, like .gitignore, should be respected.
* See the vscode setting `"search.useGlobalIgnoreFiles"`.
*/
useGlobalIgnoreFiles: boolean;
/**
* Whether files in parent directories that exclude files, like .gitignore, should be respected.
* See the vscode setting `"search.useParentIgnoreFiles"`.
*/
useParentIgnoreFiles: boolean;
}
/**
* Options to specify the size of the result text preview.
* These options don't affect the size of the match itself, just the amount of preview text.
*/
export interface TextSearchPreviewOptions {
/**
* The maximum number of lines in the preview.
* Only search providers that support multiline search will ever return more than one line in the match.
*/
matchLines: number;
/**
* The maximum number of characters included per line.
*/
charsPerLine: number;
}
/**
* Options that apply to text search.
*/
export interface TextSearchOptions extends SearchOptions {
/**
* The maximum number of results to be returned.
*/
maxResults: number;
/**
* Options to specify the size of the result text preview.
*/
previewOptions?: TextSearchPreviewOptions;
/**
* Exclude files larger than `maxFileSize` in bytes.
*/
maxFileSize?: number;
/**
* Interpret files using this encoding.
* See the vscode setting `"files.encoding"`
*/
encoding?: string;
/**
* Number of lines of context to include before each match.
*/
beforeContext?: number;
/**
* Number of lines of context to include after each match.
*/
afterContext?: number;
}
/**
* Represents the severity of a TextSearchComplete message.
*/
export enum TextSearchCompleteMessageType {
Information = 1,
Warning = 2,
}
/**
* A message regarding a completed search.
*/
export interface TextSearchCompleteMessage {
/**
* Markdown text of the message.
*/
text: string;
/**
* Whether the source of the message is trusted, command links are disabled for untrusted message sources.
* Messaged are untrusted by default.
*/
trusted?: boolean;
/**
* The message type, this affects how the message will be rendered.
*/
type: TextSearchCompleteMessageType;
}
/**
* Information collected when text search is complete.
*/
export interface TextSearchComplete {
/**
* Whether the search hit the limit on the maximum number of search results.
* `maxResults` on {@linkcode TextSearchOptions} specifies the max number of results.
* - If exactly that number of matches exist, this should be false.
* - If `maxResults` matches are returned and more exist, this should be true.
* - If search hits an internal limit which is less than `maxResults`, this should be true.
*/
limitHit?: boolean;
/**
* Additional information regarding the state of the completed search.
*
* Messages with "Information" style support links in markdown syntax:
* - Click to [run a command](command:workbench.action.OpenQuickPick)
* - Click to [open a website](https://aka.ms)
*
* Commands may optionally return { triggerSearch: true } to signal to the editor that the original search should run be again.
*/
message?: TextSearchCompleteMessage | TextSearchCompleteMessage[];
}
/**
* A preview of the text result.
*/
export interface TextSearchMatchPreview {
/**
* The matching lines of text, or a portion of the matching line that contains the match.
*/
text: string;
/**
* The Range within `text` corresponding to the text of the match.
* The number of matches must match the TextSearchMatch's range property.
*/
matches: Range | Range[];
}
/**
* A match from a text search
*/
export interface TextSearchMatch {
/**
* The uri for the matching document.
*/
uri: Uri;
/**
* The range of the match within the document, or multiple ranges for multiple matches.
*/
ranges: Range | Range[];
/**
* A preview of the text match.
*/
preview: TextSearchMatchPreview;
}
/**
* A line of context surrounding a TextSearchMatch.
*/
export interface TextSearchContext {
/**
* The uri for the matching document.
*/
uri: Uri;
/**
* One line of text.
* previewOptions.charsPerLine applies to this
*/
text: string;
/**
* The line number of this line of context.
*/
lineNumber: number;
}
export type TextSearchResult = TextSearchMatch | TextSearchContext;
/**
* A TextSearchProvider provides search results for text results inside files in the workspace.
*/
export interface TextSearchProvider {
/**
* Provide results that match the given text pattern.
* @param query The parameters for this query.
* @param options A set of options to consider while searching.
* @param progress A progress callback that must be invoked for all results.
* @param token A cancellation token.
*/
provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
}
export namespace workspace {
/**
* Register a text search provider.
*
* Only one provider can be registered per scheme.
*
* @param scheme The provider will be invoked for workspace folders that have this file scheme.
* @param provider The provider.
* @return A {@link Disposable} that unregisters this provider when being disposed.
*/
export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
}
}
| src/vscode-dts/vscode.proposed.textSearchProvider.d.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0002679591125342995,
0.00017407054838258773,
0.00016278312250506133,
0.0001672285288805142,
0.00002178643990191631
]
|
{
"id": 4,
"code_window": [
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.fileGlobs%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 540
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.7380441427230835,
0.011983846314251423,
0.00016338459681719542,
0.0001710332144284621,
0.09149112552404404
]
|
{
"id": 4,
"code_window": [
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.fileGlobs%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 540
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ | extensions/css-language-features/server/test/pathCompletionFixtures/scss/main.scss | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001754789991537109,
0.0001754789991537109,
0.0001754789991537109,
0.0001754789991537109,
0
]
|
{
"id": 4,
"code_window": [
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.fileGlobs%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 540
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ISearchService } from 'vs/workbench/services/search/common/search';
import { SearchService } from 'vs/workbench/services/search/common/searchService';
registerSingleton(ISearchService, SearchService, InstantiationType.Delayed);
| src/vs/workbench/services/search/electron-sandbox/searchService.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017442287935409695,
0.00017341211787424982,
0.00017240134184248745,
0.00017341211787424982,
0.0000010107687558047473
]
|
{
"id": 4,
"code_window": [
" \"type\": \"string\",\n",
" \"default\": \"**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}\",\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.fileGlobs%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 540
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IReader, IObservable, IObserver } from 'vs/base/common/observableImpl/base';
import { getLogger } from 'vs/base/common/observableImpl/logging';
export function autorun(debugName: string, fn: (reader: IReader) => void): IDisposable {
return new AutorunObserver(debugName, fn, undefined);
}
interface IChangeContext {
readonly changedObservable: IObservable<any, any>;
readonly change: unknown;
didChange<T, TChange>(observable: IObservable<T, TChange>): this is { change: TChange };
}
export function autorunHandleChanges(
debugName: string,
options: {
/**
* Returns if this change should cause a re-run of the autorun.
*/
handleChange: (context: IChangeContext) => boolean;
},
fn: (reader: IReader) => void
): IDisposable {
return new AutorunObserver(debugName, fn, options.handleChange);
}
export function autorunWithStore(
fn: (reader: IReader, store: DisposableStore) => void,
debugName: string
): IDisposable {
const store = new DisposableStore();
const disposable = autorun(
debugName,
reader => {
store.clear();
fn(reader, store);
}
);
return toDisposable(() => {
disposable.dispose();
store.dispose();
});
}
export class AutorunObserver implements IObserver, IReader, IDisposable {
public needsToRun = true;
private updateCount = 0;
private disposed = false;
/**
* The actual dependencies.
*/
private _dependencies = new Set<IObservable<any>>();
public get dependencies() {
return this._dependencies;
}
/**
* Dependencies that have to be removed when {@link runFn} ran through.
*/
private staleDependencies = new Set<IObservable<any>>();
constructor(
public readonly debugName: string,
private readonly runFn: (reader: IReader) => void,
private readonly _handleChange: ((context: IChangeContext) => boolean) | undefined
) {
getLogger()?.handleAutorunCreated(this);
this.runIfNeeded();
}
public subscribeTo<T>(observable: IObservable<T>) {
// In case the run action disposes the autorun
if (this.disposed) {
return;
}
this._dependencies.add(observable);
if (!this.staleDependencies.delete(observable)) {
observable.addObserver(this);
}
}
public handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void {
const shouldReact = this._handleChange ? this._handleChange({
changedObservable: observable,
change,
didChange: o => o === observable as any,
}) : true;
this.needsToRun = this.needsToRun || shouldReact;
if (this.updateCount === 0) {
this.runIfNeeded();
}
}
public beginUpdate(): void {
this.updateCount++;
}
public endUpdate(): void {
this.updateCount--;
if (this.updateCount === 0) {
this.runIfNeeded();
}
}
private runIfNeeded(): void {
if (!this.needsToRun) {
return;
}
// Assert: this.staleDependencies is an empty set.
const emptySet = this.staleDependencies;
this.staleDependencies = this._dependencies;
this._dependencies = emptySet;
this.needsToRun = false;
getLogger()?.handleAutorunTriggered(this);
try {
this.runFn(this);
} finally {
// We don't want our observed observables to think that they are (not even temporarily) not being observed.
// Thus, we only unsubscribe from observables that are definitely not read anymore.
for (const o of this.staleDependencies) {
o.removeObserver(this);
}
this.staleDependencies.clear();
}
}
public dispose(): void {
this.disposed = true;
for (const o of this._dependencies) {
o.removeObserver(this);
}
this._dependencies.clear();
}
public toString(): string {
return `Autorun<${this.debugName}>`;
}
}
export namespace autorun {
export const Observer = AutorunObserver;
}
export function autorunDelta<T>(
name: string,
observable: IObservable<T>,
handler: (args: { lastValue: T | undefined; newValue: T }) => void
): IDisposable {
let _lastValue: T | undefined;
return autorun(name, (reader) => {
const newValue = observable.read(reader);
const lastValue = _lastValue;
_lastValue = newValue;
handler({ lastValue, newValue });
});
}
| src/vs/base/common/observableImpl/autorun.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001754104159772396,
0.00017224061593879014,
0.00016293142107315361,
0.0001730015646899119,
0.000002990296025018324
]
|
{
"id": 5,
"code_window": [
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enableForDirectories\": {\n",
" \"type\": \"boolean\",\n",
" \"default\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enableForDirectories\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 546
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9936876893043518,
0.01594599336385727,
0.00016345067706424743,
0.00020185238099657,
0.12318605929613113
]
|
{
"id": 5,
"code_window": [
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enableForDirectories\": {\n",
" \"type\": \"boolean\",\n",
" \"default\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enableForDirectories\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 546
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import 'mocha';
import * as vscode from 'vscode';
import { createTestEditor, wait } from '../../test/testUtils';
import { disposeAll } from '../../utils/dispose';
type VsCodeConfiguration = { [key: string]: any };
async function updateConfig(newConfig: VsCodeConfiguration): Promise<VsCodeConfiguration> {
const oldConfig: VsCodeConfiguration = {};
const config = vscode.workspace.getConfiguration(undefined);
for (const configKey of Object.keys(newConfig)) {
oldConfig[configKey] = config.get(configKey);
await new Promise<void>((resolve, reject) =>
config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global)
.then(() => resolve(), reject));
}
return oldConfig;
}
namespace Config {
export const referencesCodeLens = 'typescript.referencesCodeLens.enabled';
}
suite('TypeScript References', () => {
const configDefaults = Object.freeze<VsCodeConfiguration>({
[Config.referencesCodeLens]: true,
});
const _disposables: vscode.Disposable[] = [];
let oldConfig: { [key: string]: any } = {};
setup(async () => {
// the tests assume that typescript features are registered
await vscode.extensions.getExtension('vscode.typescript-language-features')!.activate();
// Save off config and apply defaults
oldConfig = await updateConfig(configDefaults);
});
teardown(async () => {
disposeAll(_disposables);
// Restore config
await updateConfig(oldConfig);
return vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
test('Should show on basic class', async () => {
const testDocumentUri = vscode.Uri.parse('untitled:test1.ts');
await createTestEditor(testDocumentUri,
`class Foo {}`
);
const codeLenses = await getCodeLenses(testDocumentUri);
assert.strictEqual(codeLenses?.length, 1);
assert.strictEqual(codeLenses?.[0].range.start.line, 0);
});
test('Should show on basic class properties', async () => {
const testDocumentUri = vscode.Uri.parse('untitled:test2.ts');
await createTestEditor(testDocumentUri,
`class Foo {`,
` prop: number;`,
` meth(): void {}`,
`}`
);
const codeLenses = await getCodeLenses(testDocumentUri);
assert.strictEqual(codeLenses?.length, 3);
assert.strictEqual(codeLenses?.[0].range.start.line, 0);
assert.strictEqual(codeLenses?.[1].range.start.line, 1);
assert.strictEqual(codeLenses?.[2].range.start.line, 2);
});
test('Should not show on const property', async () => {
const testDocumentUri = vscode.Uri.parse('untitled:test3.ts');
await createTestEditor(testDocumentUri,
`const foo = {`,
` prop: 1;`,
` meth(): void {}`,
`}`
);
const codeLenses = await getCodeLenses(testDocumentUri);
assert.strictEqual(codeLenses?.length, 0);
});
test.skip('Should not show duplicate references on ES5 class (https://github.com/microsoft/vscode/issues/90396)', async () => {
const testDocumentUri = vscode.Uri.parse('untitled:test3.js');
await createTestEditor(testDocumentUri,
`function A() {`,
` console.log("hi");`,
`}`,
`A.x = {};`,
);
await wait(500);
const codeLenses = await getCodeLenses(testDocumentUri);
assert.strictEqual(codeLenses?.length, 1);
});
});
function getCodeLenses(document: vscode.Uri): Thenable<readonly vscode.CodeLens[] | undefined> {
return vscode.commands.executeCommand<readonly vscode.CodeLens[]>('vscode.executeCodeLensProvider', document, 100);
}
| extensions/typescript-language-features/src/test/smoke/referencesCodeLens.test.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017578362894710153,
0.00017174605454783887,
0.00016475189477205276,
0.00017226391355507076,
0.000002827769321811502
]
|
{
"id": 5,
"code_window": [
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enableForDirectories\": {\n",
" \"type\": \"boolean\",\n",
" \"default\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enableForDirectories\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 546
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as dom from 'vs/base/browser/dom';
import { EventType, Gesture } from 'vs/base/browser/touch';
import { ISelectBoxDelegate, ISelectBoxOptions, ISelectBoxStyles, ISelectData, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
import * as arrays from 'vs/base/common/arrays';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Disposable } from 'vs/base/common/lifecycle';
import { isMacintosh } from 'vs/base/common/platform';
export class SelectBoxNative extends Disposable implements ISelectBoxDelegate {
private selectElement: HTMLSelectElement;
private selectBoxOptions: ISelectBoxOptions;
private options: ISelectOptionItem[];
private selected = 0;
private readonly _onDidSelect: Emitter<ISelectData>;
private styles: ISelectBoxStyles;
constructor(options: ISelectOptionItem[], selected: number, styles: ISelectBoxStyles, selectBoxOptions?: ISelectBoxOptions) {
super();
this.selectBoxOptions = selectBoxOptions || Object.create(null);
this.options = [];
this.selectElement = document.createElement('select');
this.selectElement.className = 'monaco-select-box';
if (typeof this.selectBoxOptions.ariaLabel === 'string') {
this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel);
}
if (typeof this.selectBoxOptions.ariaDescription === 'string') {
this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription);
}
this._onDidSelect = this._register(new Emitter<ISelectData>());
this.styles = styles;
this.registerListeners();
this.setOptions(options, selected);
}
private registerListeners() {
this._register(Gesture.addTarget(this.selectElement));
[EventType.Tap].forEach(eventType => {
this._register(dom.addDisposableListener(this.selectElement, eventType, (e) => {
this.selectElement.focus();
}));
});
this._register(dom.addStandardDisposableListener(this.selectElement, 'click', (e) => {
dom.EventHelper.stop(e, true);
}));
this._register(dom.addStandardDisposableListener(this.selectElement, 'change', (e) => {
this.selectElement.title = e.target.value;
this._onDidSelect.fire({
index: e.target.selectedIndex,
selected: e.target.value
});
}));
this._register(dom.addStandardDisposableListener(this.selectElement, 'keydown', (e) => {
let showSelect = false;
if (isMacintosh) {
if (e.keyCode === KeyCode.DownArrow || e.keyCode === KeyCode.UpArrow || e.keyCode === KeyCode.Space) {
showSelect = true;
}
} else {
if (e.keyCode === KeyCode.DownArrow && e.altKey || e.keyCode === KeyCode.Space || e.keyCode === KeyCode.Enter) {
showSelect = true;
}
}
if (showSelect) {
// Space, Enter, is used to expand select box, do not propagate it (prevent action bar action run)
e.stopPropagation();
}
}));
}
public get onDidSelect(): Event<ISelectData> {
return this._onDidSelect.event;
}
public setOptions(options: ISelectOptionItem[], selected?: number): void {
if (!this.options || !arrays.equals(this.options, options)) {
this.options = options;
this.selectElement.options.length = 0;
this.options.forEach((option, index) => {
this.selectElement.add(this.createOption(option.text, index, option.isDisabled));
});
}
if (selected !== undefined) {
this.select(selected);
}
}
public select(index: number): void {
if (this.options.length === 0) {
this.selected = 0;
} else if (index >= 0 && index < this.options.length) {
this.selected = index;
} else if (index > this.options.length - 1) {
// Adjust index to end of list
// This could make client out of sync with the select
this.select(this.options.length - 1);
} else if (this.selected < 0) {
this.selected = 0;
}
this.selectElement.selectedIndex = this.selected;
if ((this.selected < this.options.length) && typeof this.options[this.selected].text === 'string') {
this.selectElement.title = this.options[this.selected].text;
} else {
this.selectElement.title = '';
}
}
public setAriaLabel(label: string): void {
this.selectBoxOptions.ariaLabel = label;
this.selectElement.setAttribute('aria-label', label);
}
public focus(): void {
if (this.selectElement) {
this.selectElement.tabIndex = 0;
this.selectElement.focus();
}
}
public blur(): void {
if (this.selectElement) {
this.selectElement.tabIndex = -1;
this.selectElement.blur();
}
}
public setFocusable(focusable: boolean): void {
this.selectElement.tabIndex = focusable ? 0 : -1;
}
public render(container: HTMLElement): void {
container.classList.add('select-container');
container.appendChild(this.selectElement);
this.setOptions(this.options, this.selected);
this.applyStyles();
}
public style(styles: ISelectBoxStyles): void {
this.styles = styles;
this.applyStyles();
}
public applyStyles(): void {
// Style native select
if (this.selectElement) {
const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : '';
const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : '';
const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : '';
this.selectElement.style.backgroundColor = background;
this.selectElement.style.color = foreground;
this.selectElement.style.borderColor = border;
}
}
private createOption(value: string, index: number, disabled?: boolean): HTMLOptionElement {
const option = document.createElement('option');
option.value = value;
option.text = value;
option.disabled = !!disabled;
return option;
}
}
| src/vs/base/browser/ui/selectBox/selectBoxNative.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017432427557650954,
0.00017019521328620613,
0.00016685169248376042,
0.00017014212789945304,
0.0000018206775393991848
]
|
{
"id": 5,
"code_window": [
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" },\n",
" \"markdown.experimental.updateLinksOnFileMove.enableForDirectories\": {\n",
" \"type\": \"boolean\",\n",
" \"default\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
" \"markdown.updateLinksOnFileMove.enableForDirectories\": {\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 546
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { PreTrie, ExplorerFileNestingTrie, SufTrie } from 'vs/workbench/contrib/files/common/explorerFileNestingTrie';
import * as assert from 'assert';
const fakeFilenameAttributes = { dirname: 'mydir', basename: '', extname: '' };
suite('SufTrie', () => {
test('exactMatches', () => {
const t = new SufTrie();
t.add('.npmrc', 'MyKey');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), []);
});
test('starMatches', () => {
const t = new SufTrie();
t.add('*.npmrc', 'MyKey');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['MyKey']);
});
test('starSubstitutes', () => {
const t = new SufTrie();
t.add('*.npmrc', '${capture}.json');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['.json']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['a.json']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['a.b.c.d.json']);
});
test('multiMatches', () => {
const t = new SufTrie();
t.add('*.npmrc', 'Key1');
t.add('*.json', 'Key2');
t.add('*d.npmrc', 'Key3');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['Key1']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.json', fakeFilenameAttributes), ['Key2']);
assert.deepStrictEqual(t.get('a.json', fakeFilenameAttributes), ['Key2']);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['Key1']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['Key1', 'Key3']);
});
test('multiSubstitutes', () => {
const t = new SufTrie();
t.add('*.npmrc', 'Key1.${capture}.js');
t.add('*.json', 'Key2.${capture}.js');
t.add('*d.npmrc', 'Key3.${capture}.js');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['Key1..js']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.json', fakeFilenameAttributes), ['Key2..js']);
assert.deepStrictEqual(t.get('a.json', fakeFilenameAttributes), ['Key2.a.js']);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['Key1.a.js']);
assert.deepStrictEqual(t.get('a.b.cd.npmrc', fakeFilenameAttributes), ['Key1.a.b.cd.js', 'Key3.a.b.c.js']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['Key1.a.b.c.d.js', 'Key3.a.b.c..js']);
});
});
suite('PreTrie', () => {
test('exactMatches', () => {
const t = new PreTrie();
t.add('.npmrc', 'MyKey');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), []);
});
test('starMatches', () => {
const t = new PreTrie();
t.add('*.npmrc', 'MyKey');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['MyKey']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['MyKey']);
});
test('starSubstitutes', () => {
const t = new PreTrie();
t.add('*.npmrc', '${capture}.json');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['.json']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['a.json']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['a.b.c.d.json']);
});
test('multiMatches', () => {
const t = new PreTrie();
t.add('*.npmrc', 'Key1');
t.add('*.json', 'Key2');
t.add('*d.npmrc', 'Key3');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['Key1']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.json', fakeFilenameAttributes), ['Key2']);
assert.deepStrictEqual(t.get('a.json', fakeFilenameAttributes), ['Key2']);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['Key1']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['Key1', 'Key3']);
});
test('multiSubstitutes', () => {
const t = new PreTrie();
t.add('*.npmrc', 'Key1.${capture}.js');
t.add('*.json', 'Key2.${capture}.js');
t.add('*d.npmrc', 'Key3.${capture}.js');
assert.deepStrictEqual(t.get('.npmrc', fakeFilenameAttributes), ['Key1..js']);
assert.deepStrictEqual(t.get('npmrc', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.npmrcs', fakeFilenameAttributes), []);
assert.deepStrictEqual(t.get('.json', fakeFilenameAttributes), ['Key2..js']);
assert.deepStrictEqual(t.get('a.json', fakeFilenameAttributes), ['Key2.a.js']);
assert.deepStrictEqual(t.get('a.npmrc', fakeFilenameAttributes), ['Key1.a.js']);
assert.deepStrictEqual(t.get('a.b.cd.npmrc', fakeFilenameAttributes), ['Key1.a.b.cd.js', 'Key3.a.b.c.js']);
assert.deepStrictEqual(t.get('a.b.c.d.npmrc', fakeFilenameAttributes), ['Key1.a.b.c.d.js', 'Key3.a.b.c..js']);
});
test('emptyMatches', () => {
const t = new PreTrie();
t.add('package*json', 'package');
assert.deepStrictEqual(t.get('package.json', fakeFilenameAttributes), ['package']);
assert.deepStrictEqual(t.get('packagejson', fakeFilenameAttributes), ['package']);
assert.deepStrictEqual(t.get('package-lock.json', fakeFilenameAttributes), ['package']);
});
});
suite('StarTrie', () => {
const assertMapEquals = (actual: Map<string, Set<string>>, expected: Record<string, string[]>) => {
const actualStr = [...actual.entries()].map(e => `${e[0]} => [${[...e[1].keys()].join()}]`);
const expectedStr = Object.entries(expected).map(e => `${e[0]}: [${[e[1]].join()}]`);
const bigMsg = actualStr + '===' + expectedStr;
assert.strictEqual(actual.size, Object.keys(expected).length, bigMsg);
for (const parent of actual.keys()) {
const act = actual.get(parent)!;
const exp = expected[parent];
const str = [...act.keys()].join() + '===' + exp.join();
const msg = bigMsg + '\n' + str;
assert(act.size === exp.length, msg);
for (const child of exp) {
assert(act.has(child), msg);
}
}
};
test('does added extension nesting', () => {
const t = new ExplorerFileNestingTrie([
['*', ['${capture}.*']],
]);
const nesting = t.nest([
'file',
'file.json',
'boop.test',
'boop.test1',
'boop.test.1',
'beep',
'beep.test1',
'beep.boop.test1',
'beep.boop.test2',
'beep.boop.a',
], 'mydir');
assertMapEquals(nesting, {
'file': ['file.json'],
'boop.test': ['boop.test.1'],
'boop.test1': [],
'beep': ['beep.test1', 'beep.boop.test1', 'beep.boop.test2', 'beep.boop.a']
});
});
test('does ext specific nesting', () => {
const t = new ExplorerFileNestingTrie([
['*.ts', ['${capture}.js']],
['*.js', ['${capture}.map']],
]);
const nesting = t.nest([
'a.ts',
'a.js',
'a.jss',
'ab.js',
'b.js',
'b.map',
'c.ts',
'c.js',
'c.map',
'd.ts',
'd.map',
], 'mydir');
assertMapEquals(nesting, {
'a.ts': ['a.js'],
'ab.js': [],
'a.jss': [],
'b.js': ['b.map'],
'c.ts': ['c.js', 'c.map'],
'd.ts': [],
'd.map': [],
});
});
test('handles loops', () => {
const t = new ExplorerFileNestingTrie([
['*.a', ['${capture}.b', '${capture}.c']],
['*.b', ['${capture}.a']],
['*.c', ['${capture}.d']],
['*.aa', ['${capture}.bb']],
['*.bb', ['${capture}.cc', '${capture}.dd']],
['*.cc', ['${capture}.aa']],
['*.dd', ['${capture}.ee']],
]);
const nesting = t.nest([
'.a', '.b', '.c', '.d',
'a.a', 'a.b', 'a.d',
'a.aa', 'a.bb', 'a.cc',
'b.aa', 'b.bb',
'c.bb', 'c.cc',
'd.aa', 'd.cc',
'e.aa', 'e.bb', 'e.dd', 'e.ee',
'f.aa', 'f.bb', 'f.cc', 'f.dd', 'f.ee',
], 'mydir');
assertMapEquals(nesting, {
'.a': [], '.b': [], '.c': [], '.d': [],
'a.a': [], 'a.b': [], 'a.d': [],
'a.aa': [], 'a.bb': [], 'a.cc': [],
'b.aa': ['b.bb'],
'c.bb': ['c.cc'],
'd.cc': ['d.aa'],
'e.aa': ['e.bb', 'e.dd', 'e.ee'],
'f.aa': [], 'f.bb': [], 'f.cc': [], 'f.dd': [], 'f.ee': []
});
});
test('does general bidirectional suffix matching', () => {
const t = new ExplorerFileNestingTrie([
['*-vsdoc.js', ['${capture}.js']],
['*.js', ['${capture}-vscdoc.js']],
]);
const nesting = t.nest([
'a-vsdoc.js',
'a.js',
'b.js',
'b-vscdoc.js',
], 'mydir');
assertMapEquals(nesting, {
'a-vsdoc.js': ['a.js'],
'b.js': ['b-vscdoc.js'],
});
});
test('does general bidirectional prefix matching', () => {
const t = new ExplorerFileNestingTrie([
['vsdoc-*.js', ['${capture}.js']],
['*.js', ['vscdoc-${capture}.js']],
]);
const nesting = t.nest([
'vsdoc-a.js',
'a.js',
'b.js',
'vscdoc-b.js',
], 'mydir');
assertMapEquals(nesting, {
'vsdoc-a.js': ['a.js'],
'b.js': ['vscdoc-b.js'],
});
});
test('does general bidirectional general matching', () => {
const t = new ExplorerFileNestingTrie([
['foo-*-bar.js', ['${capture}.js']],
['*.js', ['bib-${capture}-bap.js']],
]);
const nesting = t.nest([
'foo-a-bar.js',
'a.js',
'b.js',
'bib-b-bap.js',
], 'mydir');
assertMapEquals(nesting, {
'foo-a-bar.js': ['a.js'],
'b.js': ['bib-b-bap.js'],
});
});
test('does extension specific path segment matching', () => {
const t = new ExplorerFileNestingTrie([
['*.js', ['${capture}.*.js']],
]);
const nesting = t.nest([
'foo.js',
'foo.test.js',
'fooTest.js',
'bar.js.js',
], 'mydir');
assertMapEquals(nesting, {
'foo.js': ['foo.test.js'],
'fooTest.js': [],
'bar.js.js': [],
});
});
test('does exact match nesting', () => {
const t = new ExplorerFileNestingTrie([
['package.json', ['.npmrc', 'npm-shrinkwrap.json', 'yarn.lock', '.yarnclean', '.yarnignore', '.yarn-integrity', '.yarnrc']],
['bower.json', ['.bowerrc']],
]);
const nesting = t.nest([
'package.json',
'.npmrc', 'npm-shrinkwrap.json', 'yarn.lock',
'.bowerrc',
], 'mydir');
assertMapEquals(nesting, {
'package.json': [
'.npmrc', 'npm-shrinkwrap.json', 'yarn.lock'],
'.bowerrc': [],
});
});
test('eslint test', () => {
const t = new ExplorerFileNestingTrie([
['.eslintrc*', ['.eslint*']],
]);
const nesting1 = t.nest([
'.eslintrc.json',
'.eslintignore',
], 'mydir');
assertMapEquals(nesting1, {
'.eslintrc.json': ['.eslintignore'],
});
const nesting2 = t.nest([
'.eslintrc',
'.eslintignore',
], 'mydir');
assertMapEquals(nesting2, {
'.eslintrc': ['.eslintignore'],
});
});
test('basename expansion', () => {
const t = new ExplorerFileNestingTrie([
['*-vsdoc.js', ['${basename}.doc']],
]);
const nesting1 = t.nest([
'boop-vsdoc.js',
'boop-vsdoc.doc',
'boop.doc',
], 'mydir');
assertMapEquals(nesting1, {
'boop-vsdoc.js': ['boop-vsdoc.doc'],
'boop.doc': [],
});
});
test('extname expansion', () => {
const t = new ExplorerFileNestingTrie([
['*-vsdoc.js', ['${extname}.doc']],
]);
const nesting1 = t.nest([
'boop-vsdoc.js',
'js.doc',
'boop.doc',
], 'mydir');
assertMapEquals(nesting1, {
'boop-vsdoc.js': ['js.doc'],
'boop.doc': [],
});
});
test('added segment matcher', () => {
const t = new ExplorerFileNestingTrie([
['*', ['${basename}.*.${extname}']],
]);
const nesting1 = t.nest([
'some.file',
'some.html.file',
'some.html.nested.file',
'other.file',
'some.thing',
'some.thing.else',
], 'mydir');
assertMapEquals(nesting1, {
'some.file': ['some.html.file', 'some.html.nested.file'],
'other.file': [],
'some.thing': [],
'some.thing.else': [],
});
});
test('added segment matcher (old format)', () => {
const t = new ExplorerFileNestingTrie([
['*', ['$(basename).*.$(extname)']],
]);
const nesting1 = t.nest([
'some.file',
'some.html.file',
'some.html.nested.file',
'other.file',
'some.thing',
'some.thing.else',
], 'mydir');
assertMapEquals(nesting1, {
'some.file': ['some.html.file', 'some.html.nested.file'],
'other.file': [],
'some.thing': [],
'some.thing.else': [],
});
});
test('dirname matching', () => {
const t = new ExplorerFileNestingTrie([
['index.ts', ['${dirname}.ts']],
]);
const nesting1 = t.nest([
'otherFile.ts',
'MyComponent.ts',
'index.ts',
], 'MyComponent');
assertMapEquals(nesting1, {
'index.ts': ['MyComponent.ts'],
'otherFile.ts': [],
});
});
test.skip('is fast', () => {
const bigNester = new ExplorerFileNestingTrie([
['*', ['${capture}.*']],
['*.js', ['${capture}.*.js', '${capture}.map']],
['*.jsx', ['${capture}.js']],
['*.ts', ['${capture}.js', '${capture}.*.ts']],
['*.tsx', ['${capture}.js']],
['*.css', ['${capture}.*.css', '${capture}.map']],
['*.html', ['${capture}.*.html']],
['*.htm', ['${capture}.*.htm']],
['*.less', ['${capture}.*.less', '${capture}.css']],
['*.scss', ['${capture}.*.scss', '${capture}.css']],
['*.sass', ['${capture}.css']],
['*.styl', ['${capture}.css']],
['*.coffee', ['${capture}.*.coffee', '${capture}.js']],
['*.iced', ['${capture}.*.iced', '${capture}.js']],
['*.config', ['${capture}.*.config']],
['*.cs', ['${capture}.*.cs', '${capture}.cs.d.ts']],
['*.vb', ['${capture}.*.vb']],
['*.json', ['${capture}.*.json']],
['*.md', ['${capture}.html']],
['*.mdown', ['${capture}.html']],
['*.markdown', ['${capture}.html']],
['*.mdwn', ['${capture}.html']],
['*.svg', ['${capture}.svgz']],
['*.a', ['${capture}.b']],
['*.b', ['${capture}.a']],
['*.resx', ['${capture}.designer.cs']],
['package.json', ['.npmrc', 'npm-shrinkwrap.json', 'yarn.lock', '.yarnclean', '.yarnignore', '.yarn-integrity', '.yarnrc']],
['bower.json', ['.bowerrc']],
['*-vsdoc.js', ['${capture}.js']],
['*.tt', ['${capture}.*']]
]);
const bigFiles = Array.from({ length: 50000 / 6 }).map((_, i) => [
'file' + i + '.js',
'file' + i + '.map',
'file' + i + '.css',
'file' + i + '.ts',
'file' + i + '.d.ts',
'file' + i + '.jsx',
]).flat();
const start = performance.now();
// const _bigResult =
bigNester.nest(bigFiles, 'mydir');
const end = performance.now();
assert(end - start < 1000, 'too slow...' + (end - start));
// console.log(bigResult)
});
});
| src/vs/workbench/contrib/files/test/browser/explorerFileNestingTrie.test.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017701296019367874,
0.0001718035200610757,
0.00016527349362149835,
0.00017173112428281456,
0.000002293904117323109
]
|
{
"id": 6,
"code_window": [
" \"type\": \"boolean\",\n",
" \"default\": true,\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 549
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9846579432487488,
0.015599880367517471,
0.00016214147035498172,
0.00017019000370055437,
0.1220899149775505
]
|
{
"id": 6,
"code_window": [
" \"type\": \"boolean\",\n",
" \"default\": true,\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 549
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { Schemas } from 'vs/base/common/network';
import Severity from 'vs/base/common/severity';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { IWorkingCopyHistoryEntry, IWorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistory';
import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
import { LocalHistoryFileSystemProvider } from 'vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider';
import { ContextKeyExpr, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { registerAction2, Action2, MenuId } from 'vs/platform/actions/common/actions';
import { basename, basenameOrAuthority, dirname } from 'vs/base/common/resources';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { EditorResourceAccessor, SaveSourceRegistry, SideBySideEditor } from 'vs/workbench/common/editor';
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ActiveEditorContext, ResourceContextKey } from 'vs/workbench/common/contextkeys';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { IModelService } from 'vs/editor/common/services/model';
import { ILanguageService } from 'vs/editor/common/languages/language';
import { ILabelService } from 'vs/platform/label/common/label';
import { firstOrDefault } from 'vs/base/common/arrays';
import { getLocalHistoryDateFormatter, LOCAL_HISTORY_ICON_RESTORE, LOCAL_HISTORY_MENU_CONTEXT_KEY } from 'vs/workbench/contrib/localHistory/browser/localHistory';
import { IPathService } from 'vs/workbench/services/path/common/pathService';
const LOCAL_HISTORY_CATEGORY = { value: localize('localHistory.category', "Local History"), original: 'Local History' };
export interface ITimelineCommandArgument {
uri: URI;
handle: string;
}
//#region Compare with File
export const COMPARE_WITH_FILE_LABEL = { value: localize('localHistory.compareWithFile', "Compare with File"), original: 'Compare with File' };
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.compareWithFile',
title: COMPARE_WITH_FILE_LABEL,
menu: {
id: MenuId.TimelineItemContext,
group: '1_compare',
order: 1,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const commandService = accessor.get(ICommandService);
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
return commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(entry, entry.workingCopy.resource));
}
}
});
//#endregion
//#region Compare with Previous
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.compareWithPrevious',
title: { value: localize('localHistory.compareWithPrevious', "Compare with Previous"), original: 'Compare with Previous' },
menu: {
id: MenuId.TimelineItemContext,
group: '1_compare',
order: 2,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const commandService = accessor.get(ICommandService);
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const editorService = accessor.get(IEditorService);
const { entry, previous } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
// Without a previous entry, just show the entry directly
if (!previous) {
return openEntry(entry, editorService);
}
// Open real diff editor
return commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(previous, entry));
}
}
});
//#endregion
//#region Select for Compare / Compare with Selected
let itemSelectedForCompare: ITimelineCommandArgument | undefined = undefined;
const LocalHistoryItemSelectedForCompare = new RawContextKey<boolean>('localHistoryItemSelectedForCompare', false, true);
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.selectForCompare',
title: { value: localize('localHistory.selectForCompare', "Select for Compare"), original: 'Select for Compare' },
menu: {
id: MenuId.TimelineItemContext,
group: '2_compare_with',
order: 2,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const contextKeyService = accessor.get(IContextKeyService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
itemSelectedForCompare = item;
LocalHistoryItemSelectedForCompare.bindTo(contextKeyService).set(true);
}
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.compareWithSelected',
title: { value: localize('localHistory.compareWithSelected', "Compare with Selected"), original: 'Compare with Selected' },
menu: {
id: MenuId.TimelineItemContext,
group: '2_compare_with',
order: 1,
when: ContextKeyExpr.and(LOCAL_HISTORY_MENU_CONTEXT_KEY, LocalHistoryItemSelectedForCompare)
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const commandService = accessor.get(ICommandService);
if (!itemSelectedForCompare) {
return;
}
const selectedEntry = (await findLocalHistoryEntry(workingCopyHistoryService, itemSelectedForCompare)).entry;
if (!selectedEntry) {
return;
}
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
return commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(selectedEntry, entry));
}
}
});
//#endregion
//#region Show Contents
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.open',
title: { value: localize('localHistory.open', "Show Contents"), original: 'Show Contents' },
menu: {
id: MenuId.TimelineItemContext,
group: '3_contents',
order: 1,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const editorService = accessor.get(IEditorService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
return openEntry(entry, editorService);
}
}
});
//#region Restore Contents
const RESTORE_CONTENTS_LABEL = { value: localize('localHistory.restore', "Restore Contents"), original: 'Restore Contents' };
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.restoreViaEditor',
title: RESTORE_CONTENTS_LABEL,
menu: {
id: MenuId.EditorTitle,
group: 'navigation',
order: -10,
when: ResourceContextKey.Scheme.isEqualTo(LocalHistoryFileSystemProvider.SCHEMA)
},
icon: LOCAL_HISTORY_ICON_RESTORE
});
}
async run(accessor: ServicesAccessor, uri: URI): Promise<void> {
const { associatedResource, location } = LocalHistoryFileSystemProvider.fromLocalHistoryFileSystem(uri);
return restore(accessor, { uri: associatedResource, handle: basenameOrAuthority(location) });
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.restore',
title: RESTORE_CONTENTS_LABEL,
menu: {
id: MenuId.TimelineItemContext,
group: '3_contents',
order: 2,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
return restore(accessor, item);
}
});
const restoreSaveSource = SaveSourceRegistry.registerSource('localHistoryRestore.source', localize('localHistoryRestore.source', "File Restored"));
async function restore(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const fileService = accessor.get(IFileService);
const dialogService = accessor.get(IDialogService);
const workingCopyService = accessor.get(IWorkingCopyService);
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const editorService = accessor.get(IEditorService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
// Ask for confirmation
const { confirmed } = await dialogService.confirm({
message: localize('confirmRestoreMessage', "Do you want to restore the contents of '{0}'?", basename(entry.workingCopy.resource)),
detail: localize('confirmRestoreDetail', "Restoring will discard any unsaved changes."),
primaryButton: localize({ key: 'restoreButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Restore"),
type: 'warning'
});
if (!confirmed) {
return;
}
// Revert all dirty working copies for target
const workingCopies = workingCopyService.getAll(entry.workingCopy.resource);
if (workingCopies) {
for (const workingCopy of workingCopies) {
if (workingCopy.isDirty()) {
await workingCopy.revert({ soft: true });
}
}
}
// Replace target with contents of history entry
try {
await fileService.cloneFile(entry.location, entry.workingCopy.resource);
} catch (error) {
// It is possible that we fail to copy the history entry to the
// destination, for example when the destination is write protected.
// In that case tell the user and return, it is still possible for
// the user to manually copy the changes over from the diff editor.
await dialogService.show(Severity.Error, localize('unableToRestore', "Unable to restore '{0}'.", basename(entry.workingCopy.resource)), undefined, { detail: toErrorMessage(error) });
return;
}
// Restore all working copies for target
if (workingCopies) {
for (const workingCopy of workingCopies) {
await workingCopy.revert({ force: true });
}
}
// Open target
await editorService.openEditor({ resource: entry.workingCopy.resource });
// Add new entry
await workingCopyHistoryService.addEntry({
resource: entry.workingCopy.resource,
source: restoreSaveSource
}, CancellationToken.None);
// Close source
await closeEntry(entry, editorService);
}
}
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.restoreViaPicker',
title: { value: localize('localHistory.restoreViaPicker', "Find Entry to Restore"), original: 'Find Entry to Restore' },
f1: true,
category: LOCAL_HISTORY_CATEGORY
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const quickInputService = accessor.get(IQuickInputService);
const modelService = accessor.get(IModelService);
const languageService = accessor.get(ILanguageService);
const labelService = accessor.get(ILabelService);
const editorService = accessor.get(IEditorService);
const fileService = accessor.get(IFileService);
const commandService = accessor.get(ICommandService);
// Show all resources with associated history entries in picker
// with progress because this operation will take longer the more
// files have been saved overall.
const resourcePicker = quickInputService.createQuickPick<IQuickPickItem & { resource: URI }>();
let cts = new CancellationTokenSource();
resourcePicker.onDidHide(() => cts.dispose(true));
resourcePicker.busy = true;
resourcePicker.show();
const resources = await workingCopyHistoryService.getAll(cts.token);
resourcePicker.busy = false;
resourcePicker.placeholder = localize('restoreViaPicker.filePlaceholder', "Select the file to show local history for");
resourcePicker.matchOnLabel = true;
resourcePicker.matchOnDescription = true;
resourcePicker.items = resources.map(resource => ({
resource,
label: basenameOrAuthority(resource),
description: labelService.getUriLabel(dirname(resource), { relative: true }),
iconClasses: getIconClasses(modelService, languageService, resource)
})).sort((r1, r2) => r1.resource.fsPath < r2.resource.fsPath ? -1 : 1);
await Event.toPromise(resourcePicker.onDidAccept);
resourcePicker.dispose();
const resource = firstOrDefault(resourcePicker.selectedItems)?.resource;
if (!resource) {
return;
}
// Show all entries for the picked resource in another picker
// and open the entry in the end that was selected by the user
const entryPicker = quickInputService.createQuickPick<IQuickPickItem & { entry: IWorkingCopyHistoryEntry }>();
cts = new CancellationTokenSource();
entryPicker.onDidHide(() => cts.dispose(true));
entryPicker.busy = true;
entryPicker.show();
const entries = await workingCopyHistoryService.getEntries(resource, cts.token);
entryPicker.busy = false;
entryPicker.placeholder = localize('restoreViaPicker.entryPlaceholder', "Select the local history entry to open");
entryPicker.matchOnLabel = true;
entryPicker.matchOnDescription = true;
entryPicker.items = Array.from(entries).reverse().map(entry => ({
entry,
label: `$(circle-outline) ${SaveSourceRegistry.getSourceLabel(entry.source)}`,
description: toLocalHistoryEntryDateLabel(entry.timestamp)
}));
await Event.toPromise(entryPicker.onDidAccept);
entryPicker.dispose();
const selectedItem = firstOrDefault(entryPicker.selectedItems);
if (!selectedItem) {
return;
}
const resourceExists = await fileService.exists(selectedItem.entry.workingCopy.resource);
if (resourceExists) {
return commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(selectedItem.entry, selectedItem.entry.workingCopy.resource));
}
return openEntry(selectedItem.entry, editorService);
}
});
//#endregion
//#region Rename
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.rename',
title: { value: localize('localHistory.rename', "Rename"), original: 'Rename' },
menu: {
id: MenuId.TimelineItemContext,
group: '5_edit',
order: 1,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const quickInputService = accessor.get(IQuickInputService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
const inputBox = quickInputService.createInputBox();
inputBox.title = localize('renameLocalHistoryEntryTitle', "Rename Local History Entry");
inputBox.ignoreFocusOut = true;
inputBox.placeholder = localize('renameLocalHistoryPlaceholder', "Enter the new name of the local history entry");
inputBox.value = SaveSourceRegistry.getSourceLabel(entry.source);
inputBox.show();
inputBox.onDidAccept(() => {
if (inputBox.value) {
workingCopyHistoryService.updateEntry(entry, { source: inputBox.value }, CancellationToken.None);
}
inputBox.dispose();
});
}
}
});
//#endregion
//#region Delete
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.delete',
title: { value: localize('localHistory.delete', "Delete"), original: 'Delete' },
menu: {
id: MenuId.TimelineItemContext,
group: '5_edit',
order: 2,
when: LOCAL_HISTORY_MENU_CONTEXT_KEY
}
});
}
async run(accessor: ServicesAccessor, item: ITimelineCommandArgument): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const editorService = accessor.get(IEditorService);
const dialogService = accessor.get(IDialogService);
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
if (entry) {
// Ask for confirmation
const { confirmed } = await dialogService.confirm({
message: localize('confirmDeleteMessage', "Do you want to delete the local history entry of '{0}' from {1}?", entry.workingCopy.name, toLocalHistoryEntryDateLabel(entry.timestamp)),
detail: localize('confirmDeleteDetail', "This action is irreversible!"),
primaryButton: localize({ key: 'deleteButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Delete"),
type: 'warning'
});
if (!confirmed) {
return;
}
// Remove via service
await workingCopyHistoryService.removeEntry(entry, CancellationToken.None);
// Close any opened editors
await closeEntry(entry, editorService);
}
}
});
//#endregion
//#region Delete All
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.deleteAll',
title: { value: localize('localHistory.deleteAll', "Delete All"), original: 'Delete All' },
f1: true,
category: LOCAL_HISTORY_CATEGORY
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const dialogService = accessor.get(IDialogService);
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
// Ask for confirmation
const { confirmed } = await dialogService.confirm({
message: localize('confirmDeleteAllMessage', "Do you want to delete all entries of all files in local history?"),
detail: localize('confirmDeleteAllDetail', "This action is irreversible!"),
primaryButton: localize({ key: 'deleteAllButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Delete All"),
type: 'warning'
});
if (!confirmed) {
return;
}
// Remove via service
await workingCopyHistoryService.removeAll(CancellationToken.None);
}
});
//#endregion
//#region Create
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.localHistory.create',
title: { value: localize('localHistory.create', "Create Entry"), original: 'Create Entry' },
f1: true,
category: LOCAL_HISTORY_CATEGORY,
precondition: ActiveEditorContext
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
const quickInputService = accessor.get(IQuickInputService);
const editorService = accessor.get(IEditorService);
const labelService = accessor.get(ILabelService);
const pathService = accessor.get(IPathService);
const resource = EditorResourceAccessor.getOriginalUri(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource?.scheme !== pathService.defaultUriScheme && resource?.scheme !== Schemas.vscodeUserData) {
return; // only enable for selected schemes
}
const inputBox = quickInputService.createInputBox();
inputBox.title = localize('createLocalHistoryEntryTitle', "Create Local History Entry");
inputBox.ignoreFocusOut = true;
inputBox.placeholder = localize('createLocalHistoryPlaceholder', "Enter the new name of the local history entry for '{0}'", labelService.getUriBasenameLabel(resource));
inputBox.show();
inputBox.onDidAccept(async () => {
const entrySource = inputBox.value;
inputBox.dispose();
if (entrySource) {
await workingCopyHistoryService.addEntry({ resource, source: inputBox.value }, CancellationToken.None);
}
});
}
});
//#endregion
//#region Helpers
async function openEntry(entry: IWorkingCopyHistoryEntry, editorService: IEditorService): Promise<void> {
const resource = LocalHistoryFileSystemProvider.toLocalHistoryFileSystem({ location: entry.location, associatedResource: entry.workingCopy.resource });
await editorService.openEditor({
resource,
label: localize('localHistoryEditorLabel', "{0} ({1} • {2})", entry.workingCopy.name, SaveSourceRegistry.getSourceLabel(entry.source), toLocalHistoryEntryDateLabel(entry.timestamp))
});
}
async function closeEntry(entry: IWorkingCopyHistoryEntry, editorService: IEditorService): Promise<void> {
const resource = LocalHistoryFileSystemProvider.toLocalHistoryFileSystem({ location: entry.location, associatedResource: entry.workingCopy.resource });
const editors = editorService.findEditors(resource, { supportSideBySide: SideBySideEditor.ANY });
await editorService.closeEditors(editors, { preserveFocus: true });
}
export function toDiffEditorArguments(entry: IWorkingCopyHistoryEntry, resource: URI): unknown[];
export function toDiffEditorArguments(previousEntry: IWorkingCopyHistoryEntry, entry: IWorkingCopyHistoryEntry): unknown[];
export function toDiffEditorArguments(arg1: IWorkingCopyHistoryEntry, arg2: IWorkingCopyHistoryEntry | URI): unknown[] {
// Left hand side is always a working copy history entry
const originalResource = LocalHistoryFileSystemProvider.toLocalHistoryFileSystem({ location: arg1.location, associatedResource: arg1.workingCopy.resource });
let label: string;
// Right hand side depends on how the method was called
// and is either another working copy history entry
// or the file on disk.
let modifiedResource: URI;
// Compare with file on disk
if (URI.isUri(arg2)) {
const resource = arg2;
modifiedResource = resource;
label = localize('localHistoryCompareToFileEditorLabel', "{0} ({1} • {2}) ↔ {3}", arg1.workingCopy.name, SaveSourceRegistry.getSourceLabel(arg1.source), toLocalHistoryEntryDateLabel(arg1.timestamp), arg1.workingCopy.name);
}
// Compare with another entry
else {
const modified = arg2;
modifiedResource = LocalHistoryFileSystemProvider.toLocalHistoryFileSystem({ location: modified.location, associatedResource: modified.workingCopy.resource });
label = localize('localHistoryCompareToPreviousEditorLabel', "{0} ({1} • {2}) ↔ {3} ({4} • {5})", arg1.workingCopy.name, SaveSourceRegistry.getSourceLabel(arg1.source), toLocalHistoryEntryDateLabel(arg1.timestamp), modified.workingCopy.name, SaveSourceRegistry.getSourceLabel(modified.source), toLocalHistoryEntryDateLabel(modified.timestamp));
}
return [
originalResource,
modifiedResource,
label,
undefined // important to keep order of arguments in command proper
];
}
export async function findLocalHistoryEntry(workingCopyHistoryService: IWorkingCopyHistoryService, descriptor: ITimelineCommandArgument): Promise<{ entry: IWorkingCopyHistoryEntry | undefined; previous: IWorkingCopyHistoryEntry | undefined }> {
const entries = await workingCopyHistoryService.getEntries(descriptor.uri, CancellationToken.None);
let currentEntry: IWorkingCopyHistoryEntry | undefined = undefined;
let previousEntry: IWorkingCopyHistoryEntry | undefined = undefined;
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
if (entry.id === descriptor.handle) {
currentEntry = entry;
previousEntry = entries[i - 1];
break;
}
}
return {
entry: currentEntry,
previous: previousEntry
};
}
const SEP = /\//g;
function toLocalHistoryEntryDateLabel(timestamp: number): string {
return `${getLocalHistoryDateFormatter().format(timestamp).replace(SEP, '-')}`; // preserving `/` will break editor labels, so replace it with a non-path symbol
}
//#endregion
| src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00018492362869437784,
0.00017095885414164513,
0.00016254844376817346,
0.00017116256640292704,
0.000003531349193508504
]
|
{
"id": 6,
"code_window": [
" \"type\": \"boolean\",\n",
" \"default\": true,\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 549
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Extensions, IQuickAccessProvider, IQuickAccessRegistry } from 'vs/platform/quickinput/common/quickAccess';
import { IQuickInputService, IQuickPick, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
interface IHelpQuickAccessPickItem extends IQuickPickItem {
prefix: string;
}
export class HelpQuickAccessProvider implements IQuickAccessProvider {
static PREFIX = '?';
private readonly registry = Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess);
constructor(
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IKeybindingService private readonly keybindingService: IKeybindingService
) { }
provide(picker: IQuickPick<IHelpQuickAccessPickItem>): IDisposable {
const disposables = new DisposableStore();
// Open a picker with the selected value if picked
disposables.add(picker.onDidAccept(() => {
const [item] = picker.selectedItems;
if (item) {
this.quickInputService.quickAccess.show(item.prefix, { preserveValue: true });
}
}));
// Also open a picker when we detect the user typed the exact
// name of a provider (e.g. `?term` for terminals)
disposables.add(picker.onDidChangeValue(value => {
const providerDescriptor = this.registry.getQuickAccessProvider(value.substr(HelpQuickAccessProvider.PREFIX.length));
if (providerDescriptor && providerDescriptor.prefix && providerDescriptor.prefix !== HelpQuickAccessProvider.PREFIX) {
this.quickInputService.quickAccess.show(providerDescriptor.prefix, { preserveValue: true });
}
}));
// Fill in all providers
picker.items = this.getQuickAccessProviders();
return disposables;
}
private getQuickAccessProviders(): IHelpQuickAccessPickItem[] {
const providers: IHelpQuickAccessPickItem[] = [];
for (const provider of this.registry.getQuickAccessProviders().sort((providerA, providerB) => providerA.prefix.localeCompare(providerB.prefix))) {
if (provider.prefix === HelpQuickAccessProvider.PREFIX) {
continue; // exclude help which is already active
}
for (const helpEntry of provider.helpEntries) {
const prefix = helpEntry.prefix || provider.prefix;
const label = prefix || '\u2026' /* ... */;
providers.push({
prefix,
label,
keybinding: helpEntry.commandId ? this.keybindingService.lookupKeybinding(helpEntry.commandId) : undefined,
ariaLabel: localize('helpPickAriaLabel', "{0}, {1}", label, helpEntry.description),
description: helpEntry.description
});
}
}
return providers;
}
}
| src/vs/platform/quickinput/browser/helpQuickAccess.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017431315791327506,
0.0001708805066300556,
0.00016581127420067787,
0.00017139091505669057,
0.0000029535954126913566
]
|
{
"id": 6,
"code_window": [
" \"type\": \"boolean\",\n",
" \"default\": true,\n",
" \"description\": \"%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%\",\n",
" \"scope\": \"resource\",\n",
" \"tags\": [\n",
" \"experimental\"\n",
" ]\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"description\": \"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%\",\n"
],
"file_path": "extensions/markdown-language-features/package.json",
"type": "replace",
"edit_start_line_idx": 549
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { EDITOR_FONT_DEFAULTS, IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import * as colorRegistry from 'vs/platform/theme/common/colorRegistry';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { IWorkbenchThemeService, IWorkbenchColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { DEFAULT_FONT_FAMILY } from 'vs/workbench/browser/style';
import { WebviewStyles } from 'vs/workbench/contrib/webview/browser/webview';
interface WebviewThemeData {
readonly activeTheme: string;
readonly themeLabel: string;
readonly themeId: string;
readonly styles: Readonly<WebviewStyles>;
}
export class WebviewThemeDataProvider extends Disposable {
private _cachedWebViewThemeData: WebviewThemeData | undefined = undefined;
private readonly _onThemeDataChanged = this._register(new Emitter<void>());
public readonly onThemeDataChanged = this._onThemeDataChanged.event;
constructor(
@IWorkbenchThemeService private readonly _themeService: IWorkbenchThemeService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
super();
this._register(this._themeService.onDidColorThemeChange(() => {
this.reset();
}));
const webviewConfigurationKeys = ['editor.fontFamily', 'editor.fontWeight', 'editor.fontSize'];
this._register(this._configurationService.onDidChangeConfiguration(e => {
if (webviewConfigurationKeys.some(key => e.affectsConfiguration(key))) {
this.reset();
}
}));
}
public getTheme(): IWorkbenchColorTheme {
return this._themeService.getColorTheme();
}
public getWebviewThemeData(): WebviewThemeData {
if (!this._cachedWebViewThemeData) {
const configuration = this._configurationService.getValue<IEditorOptions>('editor');
const editorFontFamily = configuration.fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
const editorFontWeight = configuration.fontWeight || EDITOR_FONT_DEFAULTS.fontWeight;
const editorFontSize = configuration.fontSize || EDITOR_FONT_DEFAULTS.fontSize;
const theme = this._themeService.getColorTheme();
const exportedColors = colorRegistry.getColorRegistry().getColors().reduce((colors, entry) => {
const color = theme.getColor(entry.id);
if (color) {
colors['vscode-' + entry.id.replace('.', '-')] = color.toString();
}
return colors;
}, {} as { [key: string]: string });
const styles = {
'vscode-font-family': DEFAULT_FONT_FAMILY,
'vscode-font-weight': 'normal',
'vscode-font-size': '13px',
'vscode-editor-font-family': editorFontFamily,
'vscode-editor-font-weight': editorFontWeight,
'vscode-editor-font-size': editorFontSize + 'px',
...exportedColors
};
const activeTheme = ApiThemeClassName.fromTheme(theme);
this._cachedWebViewThemeData = { styles, activeTheme, themeLabel: theme.label, themeId: theme.settingsId };
}
return this._cachedWebViewThemeData;
}
private reset() {
this._cachedWebViewThemeData = undefined;
this._onThemeDataChanged.fire();
}
}
enum ApiThemeClassName {
light = 'vscode-light',
dark = 'vscode-dark',
highContrast = 'vscode-high-contrast',
highContrastLight = 'vscode-high-contrast-light',
}
namespace ApiThemeClassName {
export function fromTheme(theme: IWorkbenchColorTheme): ApiThemeClassName {
switch (theme.type) {
case ColorScheme.LIGHT: return ApiThemeClassName.light;
case ColorScheme.DARK: return ApiThemeClassName.dark;
case ColorScheme.HIGH_CONTRAST_DARK: return ApiThemeClassName.highContrast;
case ColorScheme.HIGH_CONTRAST_LIGHT: return ApiThemeClassName.highContrastLight;
}
}
}
| src/vs/workbench/contrib/webview/browser/themeing.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00020294534624554217,
0.00017364206723868847,
0.00016410530952271074,
0.0001725883485050872,
0.000010124782420461997
]
|
{
"id": 7,
"code_window": [
"\t\"configuration.markdown.validate.ignoredLinks.description\": \"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.\",\n",
"\t\"configuration.markdown.validate.unusedLinkDefinitions.description\": \"Validate link definitions that are unused in the current file.\",\n",
"\t\"configuration.markdown.validate.duplicateLinkDefinitions.description\": \"Validate duplicated definitions in the current file.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.experimental.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n",
"\t\"workspaceTrust\": \"Required for loading styles configured in the workspace.\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"configuration.markdown.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n"
],
"file_path": "extensions/markdown-language-features/package.nls.json",
"type": "replace",
"edit_start_line_idx": 41
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00792636163532734,
0.0006083503249101341,
0.00016298161062877625,
0.00024012272479012609,
0.0011058381060138345
]
|
{
"id": 7,
"code_window": [
"\t\"configuration.markdown.validate.ignoredLinks.description\": \"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.\",\n",
"\t\"configuration.markdown.validate.unusedLinkDefinitions.description\": \"Validate link definitions that are unused in the current file.\",\n",
"\t\"configuration.markdown.validate.duplicateLinkDefinitions.description\": \"Validate duplicated definitions in the current file.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.experimental.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n",
"\t\"workspaceTrust\": \"Required for loading styles configured in the workspace.\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"configuration.markdown.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n"
],
"file_path": "extensions/markdown-language-features/package.nls.json",
"type": "replace",
"edit_start_line_idx": 41
} | {
"name": "vscode-automation",
"version": "1.71.0",
"description": "VS Code UI automation driver",
"author": {
"name": "Microsoft Corporation"
},
"license": "MIT",
"main": "./out/index.js",
"private": true,
"scripts": {
"compile": "npm run copy-driver-definition && node ../../node_modules/typescript/bin/tsc",
"watch": "npm-run-all -lp watch-driver-definition watch-tsc",
"watch-tsc": "node ../../node_modules/typescript/bin/tsc --watch --preserveWatchOutput",
"copy-driver-definition": "node tools/copy-driver-definition.js",
"watch-driver-definition": "watch \"node tools/copy-driver-definition.js\"",
"copy-package-version": "node tools/copy-package-version.js",
"prepublishOnly": "npm run copy-package-version"
},
"dependencies": {
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"tmp": "0.2.1",
"tree-kill": "1.2.2",
"vscode-uri": "3.0.2"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/ncp": "2.0.1",
"@types/node": "16.x",
"@types/tmp": "0.2.2",
"cpx2": "3.0.0",
"npm-run-all": "^4.1.5",
"watch": "^1.0.2"
}
}
| test/automation/package.json | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00016483644139952958,
0.0001645106531213969,
0.00016417699225712568,
0.00016451458213850856,
2.4773038376224576e-7
]
|
{
"id": 7,
"code_window": [
"\t\"configuration.markdown.validate.ignoredLinks.description\": \"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.\",\n",
"\t\"configuration.markdown.validate.unusedLinkDefinitions.description\": \"Validate link definitions that are unused in the current file.\",\n",
"\t\"configuration.markdown.validate.duplicateLinkDefinitions.description\": \"Validate duplicated definitions in the current file.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.experimental.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n",
"\t\"workspaceTrust\": \"Required for loading styles configured in the workspace.\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"configuration.markdown.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n"
],
"file_path": "extensions/markdown-language-features/package.nls.json",
"type": "replace",
"edit_start_line_idx": 41
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { SymbolItemDragAndDrop, SymbolItemEditorHighlights, SymbolItemNavigation, SymbolTreeInput } from '../references-view';
import { asResourceUrl, del, getThemeIcon, tail } from '../utils';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class TypesTreeInput implements SymbolTreeInput<TypeItem> {
readonly title: string;
readonly contextValue: string = 'typeHierarchy';
constructor(
readonly location: vscode.Location,
readonly direction: TypeHierarchyDirection,
) {
this.title = direction === TypeHierarchyDirection.Supertypes
? localize('title.sup', 'Supertypes Of')
: localize('title.sub', 'Subtypes Of');
}
async resolve() {
const items = await Promise.resolve(vscode.commands.executeCommand<vscode.TypeHierarchyItem[]>('vscode.prepareTypeHierarchy', this.location.uri, this.location.range.start));
const model = new TypesModel(this.direction, items ?? []);
const provider = new TypeItemDataProvider(model);
if (model.roots.length === 0) {
return;
}
return {
provider,
get message() { return model.roots.length === 0 ? localize('noresult', 'No results.') : undefined; },
navigation: model,
highlights: model,
dnd: model,
dispose() {
provider.dispose();
}
};
}
with(location: vscode.Location): TypesTreeInput {
return new TypesTreeInput(location, this.direction);
}
}
export const enum TypeHierarchyDirection {
Subtypes = 'subtypes',
Supertypes = 'supertypes'
}
export class TypeItem {
children?: TypeItem[];
constructor(
readonly model: TypesModel,
readonly item: vscode.TypeHierarchyItem,
readonly parent: TypeItem | undefined,
) { }
remove(): void {
this.model.remove(this);
}
}
class TypesModel implements SymbolItemNavigation<TypeItem>, SymbolItemEditorHighlights<TypeItem>, SymbolItemDragAndDrop<TypeItem> {
readonly roots: TypeItem[] = [];
private readonly _onDidChange = new vscode.EventEmitter<TypesModel>();
readonly onDidChange = this._onDidChange.event;
constructor(readonly direction: TypeHierarchyDirection, items: vscode.TypeHierarchyItem[]) {
this.roots = items.map(item => new TypeItem(this, item, undefined));
}
private async _resolveTypes(currentType: TypeItem): Promise<TypeItem[]> {
if (this.direction === TypeHierarchyDirection.Supertypes) {
const types = await vscode.commands.executeCommand<vscode.TypeHierarchyItem[]>('vscode.provideSupertypes', currentType.item);
return types ? types.map(item => new TypeItem(this, item, currentType)) : [];
} else {
const types = await vscode.commands.executeCommand<vscode.TypeHierarchyItem[]>('vscode.provideSubtypes', currentType.item);
return types ? types.map(item => new TypeItem(this, item, currentType)) : [];
}
}
async getTypeChildren(item: TypeItem): Promise<TypeItem[]> {
if (!item.children) {
item.children = await this._resolveTypes(item);
}
return item.children;
}
// -- dnd
getDragUri(item: TypeItem): vscode.Uri | undefined {
return asResourceUrl(item.item.uri, item.item.range);
}
// -- navigation
location(currentType: TypeItem) {
return new vscode.Location(currentType.item.uri, currentType.item.range);
}
nearest(uri: vscode.Uri, _position: vscode.Position): TypeItem | undefined {
return this.roots.find(item => item.item.uri.toString() === uri.toString()) ?? this.roots[0];
}
next(from: TypeItem): TypeItem {
return this._move(from, true) ?? from;
}
previous(from: TypeItem): TypeItem {
return this._move(from, false) ?? from;
}
private _move(item: TypeItem, fwd: boolean): TypeItem | void {
if (item.children?.length) {
return fwd ? item.children[0] : tail(item.children);
}
const array = this.roots.includes(item) ? this.roots : item.parent?.children;
if (array?.length) {
const idx = array.indexOf(item);
const delta = fwd ? 1 : -1;
return array[idx + delta + array.length % array.length];
}
}
// --- highlights
getEditorHighlights(currentType: TypeItem, uri: vscode.Uri): vscode.Range[] | undefined {
return currentType.item.uri.toString() === uri.toString() ? [currentType.item.selectionRange] : undefined;
}
remove(item: TypeItem) {
const isInRoot = this.roots.includes(item);
const siblings = isInRoot ? this.roots : item.parent?.children;
if (siblings) {
del(siblings, item);
this._onDidChange.fire(this);
}
}
}
class TypeItemDataProvider implements vscode.TreeDataProvider<TypeItem> {
private readonly _emitter = new vscode.EventEmitter<TypeItem | undefined>();
readonly onDidChangeTreeData = this._emitter.event;
private readonly _modelListener: vscode.Disposable;
constructor(private _model: TypesModel) {
this._modelListener = _model.onDidChange(e => this._emitter.fire(e instanceof TypeItem ? e : undefined));
}
dispose(): void {
this._emitter.dispose();
this._modelListener.dispose();
}
getTreeItem(element: TypeItem): vscode.TreeItem {
const item = new vscode.TreeItem(element.item.name);
item.description = element.item.detail;
item.contextValue = 'type-item';
item.iconPath = getThemeIcon(element.item.kind);
item.command = {
command: 'vscode.open',
title: localize('title.openType', 'Open Type'),
arguments: [
element.item.uri,
<vscode.TextDocumentShowOptions>{ selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }
]
};
item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
return item;
}
getChildren(element?: TypeItem | undefined) {
return element
? this._model.getTypeChildren(element)
: this._model.roots;
}
getParent(element: TypeItem) {
return element.parent;
}
}
| extensions/references-view/src/types/model.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017007255519274622,
0.00016562329255975783,
0.00016080627392511815,
0.00016599506489001215,
0.000002328432401554892
]
|
{
"id": 7,
"code_window": [
"\t\"configuration.markdown.validate.ignoredLinks.description\": \"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.\",\n",
"\t\"configuration.markdown.validate.unusedLinkDefinitions.description\": \"Validate link definitions that are unused in the current file.\",\n",
"\t\"configuration.markdown.validate.duplicateLinkDefinitions.description\": \"Validate duplicated definitions in the current file.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.experimental.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n",
"\t\"workspaceTrust\": \"Required for loading styles configured in the workspace.\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"configuration.markdown.updateLinksOnFileMove.enabled\": \"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.prompt\": \"Prompt on each file move.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.always\": \"Always update links automatically.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enabled.never\": \"Never try to update link and don't prompt.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.fileGlobs\": \"A glob that specifies which files besides markdown should trigger a link update.\",\n",
"\t\"configuration.markdown.updateLinksOnFileMove.enableForDirectories\": \"enable/disable updating links when a directory is moved or renamed in the workspace.\",\n"
],
"file_path": "extensions/markdown-language-features/package.nls.json",
"type": "replace",
"edit_start_line_idx": 41
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { anyScore, createMatches, fuzzyScore, fuzzyScoreGraceful, fuzzyScoreGracefulAggressive, FuzzyScorer, IFilter, IMatch, matchesCamelCase, matchesContiguousSubString, matchesPrefix, matchesStrictPrefix, matchesSubString, matchesWords, or } from 'vs/base/common/filters';
function filterOk(filter: IFilter, word: string, wordToMatchAgainst: string, highlights?: { start: number; end: number }[]) {
const r = filter(word, wordToMatchAgainst);
assert(r, `${word} didn't match ${wordToMatchAgainst}`);
if (highlights) {
assert.deepStrictEqual(r, highlights);
}
}
function filterNotOk(filter: IFilter, word: string, wordToMatchAgainst: string) {
assert(!filter(word, wordToMatchAgainst), `${word} matched ${wordToMatchAgainst}`);
}
suite('Filters', () => {
test('or', () => {
let filter: IFilter;
let counters: number[];
const newFilter = function (i: number, r: boolean): IFilter {
return function (): IMatch[] { counters[i]++; return r as any; };
};
counters = [0, 0];
filter = or(newFilter(0, false), newFilter(1, false));
filterNotOk(filter, 'anything', 'anything');
assert.deepStrictEqual(counters, [1, 1]);
counters = [0, 0];
filter = or(newFilter(0, true), newFilter(1, false));
filterOk(filter, 'anything', 'anything');
assert.deepStrictEqual(counters, [1, 0]);
counters = [0, 0];
filter = or(newFilter(0, true), newFilter(1, true));
filterOk(filter, 'anything', 'anything');
assert.deepStrictEqual(counters, [1, 0]);
counters = [0, 0];
filter = or(newFilter(0, false), newFilter(1, true));
filterOk(filter, 'anything', 'anything');
assert.deepStrictEqual(counters, [1, 1]);
});
test('PrefixFilter - case sensitive', function () {
filterNotOk(matchesStrictPrefix, '', '');
filterOk(matchesStrictPrefix, '', 'anything', []);
filterOk(matchesStrictPrefix, 'alpha', 'alpha', [{ start: 0, end: 5 }]);
filterOk(matchesStrictPrefix, 'alpha', 'alphasomething', [{ start: 0, end: 5 }]);
filterNotOk(matchesStrictPrefix, 'alpha', 'alp');
filterOk(matchesStrictPrefix, 'a', 'alpha', [{ start: 0, end: 1 }]);
filterNotOk(matchesStrictPrefix, 'x', 'alpha');
filterNotOk(matchesStrictPrefix, 'A', 'alpha');
filterNotOk(matchesStrictPrefix, 'AlPh', 'alPHA');
});
test('PrefixFilter - ignore case', function () {
filterOk(matchesPrefix, 'alpha', 'alpha', [{ start: 0, end: 5 }]);
filterOk(matchesPrefix, 'alpha', 'alphasomething', [{ start: 0, end: 5 }]);
filterNotOk(matchesPrefix, 'alpha', 'alp');
filterOk(matchesPrefix, 'a', 'alpha', [{ start: 0, end: 1 }]);
filterOk(matchesPrefix, 'ä', 'Älpha', [{ start: 0, end: 1 }]);
filterNotOk(matchesPrefix, 'x', 'alpha');
filterOk(matchesPrefix, 'A', 'alpha', [{ start: 0, end: 1 }]);
filterOk(matchesPrefix, 'AlPh', 'alPHA', [{ start: 0, end: 4 }]);
filterNotOk(matchesPrefix, 'T', '4'); // see https://github.com/microsoft/vscode/issues/22401
});
test('CamelCaseFilter', () => {
filterNotOk(matchesCamelCase, '', '');
filterOk(matchesCamelCase, '', 'anything', []);
filterOk(matchesCamelCase, 'alpha', 'alpha', [{ start: 0, end: 5 }]);
filterOk(matchesCamelCase, 'AlPhA', 'alpha', [{ start: 0, end: 5 }]);
filterOk(matchesCamelCase, 'alpha', 'alphasomething', [{ start: 0, end: 5 }]);
filterNotOk(matchesCamelCase, 'alpha', 'alp');
filterOk(matchesCamelCase, 'c', 'CamelCaseRocks', [
{ start: 0, end: 1 }
]);
filterOk(matchesCamelCase, 'cc', 'CamelCaseRocks', [
{ start: 0, end: 1 },
{ start: 5, end: 6 }
]);
filterOk(matchesCamelCase, 'ccr', 'CamelCaseRocks', [
{ start: 0, end: 1 },
{ start: 5, end: 6 },
{ start: 9, end: 10 }
]);
filterOk(matchesCamelCase, 'cacr', 'CamelCaseRocks', [
{ start: 0, end: 2 },
{ start: 5, end: 6 },
{ start: 9, end: 10 }
]);
filterOk(matchesCamelCase, 'cacar', 'CamelCaseRocks', [
{ start: 0, end: 2 },
{ start: 5, end: 7 },
{ start: 9, end: 10 }
]);
filterOk(matchesCamelCase, 'ccarocks', 'CamelCaseRocks', [
{ start: 0, end: 1 },
{ start: 5, end: 7 },
{ start: 9, end: 14 }
]);
filterOk(matchesCamelCase, 'cr', 'CamelCaseRocks', [
{ start: 0, end: 1 },
{ start: 9, end: 10 }
]);
filterOk(matchesCamelCase, 'fba', 'FooBarAbe', [
{ start: 0, end: 1 },
{ start: 3, end: 5 }
]);
filterOk(matchesCamelCase, 'fbar', 'FooBarAbe', [
{ start: 0, end: 1 },
{ start: 3, end: 6 }
]);
filterOk(matchesCamelCase, 'fbara', 'FooBarAbe', [
{ start: 0, end: 1 },
{ start: 3, end: 7 }
]);
filterOk(matchesCamelCase, 'fbaa', 'FooBarAbe', [
{ start: 0, end: 1 },
{ start: 3, end: 5 },
{ start: 6, end: 7 }
]);
filterOk(matchesCamelCase, 'fbaab', 'FooBarAbe', [
{ start: 0, end: 1 },
{ start: 3, end: 5 },
{ start: 6, end: 8 }
]);
filterOk(matchesCamelCase, 'c2d', 'canvasCreation2D', [
{ start: 0, end: 1 },
{ start: 14, end: 16 }
]);
filterOk(matchesCamelCase, 'cce', '_canvasCreationEvent', [
{ start: 1, end: 2 },
{ start: 7, end: 8 },
{ start: 15, end: 16 }
]);
});
test('CamelCaseFilter - #19256', function () {
assert(matchesCamelCase('Debug Console', 'Open: Debug Console'));
assert(matchesCamelCase('Debug console', 'Open: Debug Console'));
assert(matchesCamelCase('debug console', 'Open: Debug Console'));
});
test('matchesContiguousSubString', () => {
filterOk(matchesContiguousSubString, 'cela', 'cancelAnimationFrame()', [
{ start: 3, end: 7 }
]);
});
test('matchesSubString', () => {
filterOk(matchesSubString, 'cmm', 'cancelAnimationFrame()', [
{ start: 0, end: 1 },
{ start: 9, end: 10 },
{ start: 18, end: 19 }
]);
filterOk(matchesSubString, 'abc', 'abcabc', [
{ start: 0, end: 3 },
]);
filterOk(matchesSubString, 'abc', 'aaabbbccc', [
{ start: 0, end: 1 },
{ start: 3, end: 4 },
{ start: 6, end: 7 },
]);
});
test('matchesSubString performance (#35346)', function () {
filterNotOk(matchesSubString, 'aaaaaaaaaaaaaaaaaaaax', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
});
test('WordFilter', () => {
filterOk(matchesWords, 'alpha', 'alpha', [{ start: 0, end: 5 }]);
filterOk(matchesWords, 'alpha', 'alphasomething', [{ start: 0, end: 5 }]);
filterNotOk(matchesWords, 'alpha', 'alp');
filterOk(matchesWords, 'a', 'alpha', [{ start: 0, end: 1 }]);
filterNotOk(matchesWords, 'x', 'alpha');
filterOk(matchesWords, 'A', 'alpha', [{ start: 0, end: 1 }]);
filterOk(matchesWords, 'AlPh', 'alPHA', [{ start: 0, end: 4 }]);
assert(matchesWords('Debug Console', 'Open: Debug Console'));
filterOk(matchesWords, 'gp', 'Git: Pull', [{ start: 0, end: 1 }, { start: 5, end: 6 }]);
filterOk(matchesWords, 'g p', 'Git: Pull', [{ start: 0, end: 1 }, { start: 5, end: 6 }]);
filterOk(matchesWords, 'gipu', 'Git: Pull', [{ start: 0, end: 2 }, { start: 5, end: 7 }]);
filterOk(matchesWords, 'gp', 'Category: Git: Pull', [{ start: 10, end: 11 }, { start: 15, end: 16 }]);
filterOk(matchesWords, 'g p', 'Category: Git: Pull', [{ start: 10, end: 11 }, { start: 15, end: 16 }]);
filterOk(matchesWords, 'gipu', 'Category: Git: Pull', [{ start: 10, end: 12 }, { start: 15, end: 17 }]);
filterNotOk(matchesWords, 'it', 'Git: Pull');
filterNotOk(matchesWords, 'll', 'Git: Pull');
filterOk(matchesWords, 'git: プル', 'git: プル', [{ start: 0, end: 7 }]);
filterOk(matchesWords, 'git プル', 'git: プル', [{ start: 0, end: 3 }, { start: 5, end: 7 }]);
filterOk(matchesWords, 'öäk', 'Öhm: Älles Klar', [{ start: 0, end: 1 }, { start: 5, end: 6 }, { start: 11, end: 12 }]);
// Handles issue #123915
filterOk(matchesWords, 'C++', 'C/C++: command', [{ start: 2, end: 5 }]);
// Handles issue #154533
filterOk(matchesWords, '.', ':', []);
filterOk(matchesWords, '.', '.', [{ start: 0, end: 1 }]);
// assert.ok(matchesWords('gipu', 'Category: Git: Pull', true) === null);
// assert.deepStrictEqual(matchesWords('pu', 'Category: Git: Pull', true), [{ start: 15, end: 17 }]);
filterOk(matchesWords, 'bar', 'foo-bar');
filterOk(matchesWords, 'bar test', 'foo-bar test');
filterOk(matchesWords, 'fbt', 'foo-bar test');
filterOk(matchesWords, 'bar test', 'foo-bar (test)');
filterOk(matchesWords, 'foo bar', 'foo (bar)');
filterNotOk(matchesWords, 'bar est', 'foo-bar test');
filterNotOk(matchesWords, 'fo ar', 'foo-bar test');
filterNotOk(matchesWords, 'for', 'foo-bar test');
filterOk(matchesWords, 'foo bar', 'foo-bar');
filterOk(matchesWords, 'foo bar', '123 foo-bar 456');
filterOk(matchesWords, 'foo-bar', 'foo bar');
filterOk(matchesWords, 'foo:bar', 'foo:bar');
});
function assertMatches(pattern: string, word: string, decoratedWord: string | undefined, filter: FuzzyScorer, opts: { patternPos?: number; wordPos?: number; firstMatchCanBeWeak?: boolean } = {}) {
const r = filter(pattern, pattern.toLowerCase(), opts.patternPos || 0, word, word.toLowerCase(), opts.wordPos || 0, { firstMatchCanBeWeak: opts.firstMatchCanBeWeak ?? false, boostFullMatch: true });
assert.ok(!decoratedWord === !r);
if (r) {
const matches = createMatches(r);
let actualWord = '';
let pos = 0;
for (const match of matches) {
actualWord += word.substring(pos, match.start);
actualWord += '^' + word.substring(match.start, match.end).split('').join('^');
pos = match.end;
}
actualWord += word.substring(pos);
assert.strictEqual(actualWord, decoratedWord);
}
}
test('fuzzyScore, #23215', function () {
assertMatches('tit', 'win.tit', 'win.^t^i^t', fuzzyScore);
assertMatches('title', 'win.title', 'win.^t^i^t^l^e', fuzzyScore);
assertMatches('WordCla', 'WordCharacterClassifier', '^W^o^r^dCharacter^C^l^assifier', fuzzyScore);
assertMatches('WordCCla', 'WordCharacterClassifier', '^W^o^r^d^Character^C^l^assifier', fuzzyScore);
});
test('fuzzyScore, #23332', function () {
assertMatches('dete', '"editor.quickSuggestionsDelay"', undefined, fuzzyScore);
});
test('fuzzyScore, #23190', function () {
assertMatches('c:\\do', '& \'C:\\Documents and Settings\'', '& \'^C^:^\\^D^ocuments and Settings\'', fuzzyScore);
assertMatches('c:\\do', '& \'c:\\Documents and Settings\'', '& \'^c^:^\\^D^ocuments and Settings\'', fuzzyScore);
});
test('fuzzyScore, #23581', function () {
assertMatches('close', 'css.lint.importStatement', '^css.^lint.imp^ort^Stat^ement', fuzzyScore);
assertMatches('close', 'css.colorDecorators.enable', '^css.co^l^orDecorator^s.^enable', fuzzyScore);
assertMatches('close', 'workbench.quickOpen.closeOnFocusOut', 'workbench.quickOpen.^c^l^o^s^eOnFocusOut', fuzzyScore);
assertTopScore(fuzzyScore, 'close', 2, 'css.lint.importStatement', 'css.colorDecorators.enable', 'workbench.quickOpen.closeOnFocusOut');
});
test('fuzzyScore, #23458', function () {
assertMatches('highlight', 'editorHoverHighlight', 'editorHover^H^i^g^h^l^i^g^h^t', fuzzyScore);
assertMatches('hhighlight', 'editorHoverHighlight', 'editor^Hover^H^i^g^h^l^i^g^h^t', fuzzyScore);
assertMatches('dhhighlight', 'editorHoverHighlight', undefined, fuzzyScore);
});
test('fuzzyScore, #23746', function () {
assertMatches('-moz', '-moz-foo', '^-^m^o^z-foo', fuzzyScore);
assertMatches('moz', '-moz-foo', '-^m^o^z-foo', fuzzyScore);
assertMatches('moz', '-moz-animation', '-^m^o^z-animation', fuzzyScore);
assertMatches('moza', '-moz-animation', '-^m^o^z-^animation', fuzzyScore);
});
test('fuzzyScore', () => {
assertMatches('ab', 'abA', '^a^bA', fuzzyScore);
assertMatches('ccm', 'cacmelCase', '^ca^c^melCase', fuzzyScore);
assertMatches('bti', 'the_black_knight', undefined, fuzzyScore);
assertMatches('ccm', 'camelCase', undefined, fuzzyScore);
assertMatches('cmcm', 'camelCase', undefined, fuzzyScore);
assertMatches('BK', 'the_black_knight', 'the_^black_^knight', fuzzyScore);
assertMatches('KeyboardLayout=', 'KeyboardLayout', undefined, fuzzyScore);
assertMatches('LLL', 'SVisualLoggerLogsList', 'SVisual^Logger^Logs^List', fuzzyScore);
assertMatches('LLLL', 'SVilLoLosLi', undefined, fuzzyScore);
assertMatches('LLLL', 'SVisualLoggerLogsList', undefined, fuzzyScore);
assertMatches('TEdit', 'TextEdit', '^Text^E^d^i^t', fuzzyScore);
assertMatches('TEdit', 'TextEditor', '^Text^E^d^i^tor', fuzzyScore);
assertMatches('TEdit', 'Textedit', '^Text^e^d^i^t', fuzzyScore);
assertMatches('TEdit', 'text_edit', '^text_^e^d^i^t', fuzzyScore);
assertMatches('TEditDit', 'TextEditorDecorationType', '^Text^E^d^i^tor^Decorat^ion^Type', fuzzyScore);
assertMatches('TEdit', 'TextEditorDecorationType', '^Text^E^d^i^torDecorationType', fuzzyScore);
assertMatches('Tedit', 'TextEdit', '^Text^E^d^i^t', fuzzyScore);
assertMatches('ba', '?AB?', undefined, fuzzyScore);
assertMatches('bkn', 'the_black_knight', 'the_^black_^k^night', fuzzyScore);
assertMatches('bt', 'the_black_knight', 'the_^black_knigh^t', fuzzyScore);
assertMatches('ccm', 'camelCasecm', '^camel^Casec^m', fuzzyScore);
assertMatches('fdm', 'findModel', '^fin^d^Model', fuzzyScore);
assertMatches('fob', 'foobar', '^f^oo^bar', fuzzyScore);
assertMatches('fobz', 'foobar', undefined, fuzzyScore);
assertMatches('foobar', 'foobar', '^f^o^o^b^a^r', fuzzyScore);
assertMatches('form', 'editor.formatOnSave', 'editor.^f^o^r^matOnSave', fuzzyScore);
assertMatches('g p', 'Git: Pull', '^Git:^ ^Pull', fuzzyScore);
assertMatches('g p', 'Git: Pull', '^Git:^ ^Pull', fuzzyScore);
assertMatches('gip', 'Git: Pull', '^G^it: ^Pull', fuzzyScore);
assertMatches('gip', 'Git: Pull', '^G^it: ^Pull', fuzzyScore);
assertMatches('gp', 'Git: Pull', '^Git: ^Pull', fuzzyScore);
assertMatches('gp', 'Git_Git_Pull', '^Git_Git_^Pull', fuzzyScore);
assertMatches('is', 'ImportStatement', '^Import^Statement', fuzzyScore);
assertMatches('is', 'isValid', '^i^sValid', fuzzyScore);
assertMatches('lowrd', 'lowWord', '^l^o^wWo^r^d', fuzzyScore);
assertMatches('myvable', 'myvariable', '^m^y^v^aria^b^l^e', fuzzyScore);
assertMatches('no', '', undefined, fuzzyScore);
assertMatches('no', 'match', undefined, fuzzyScore);
assertMatches('ob', 'foobar', undefined, fuzzyScore);
assertMatches('sl', 'SVisualLoggerLogsList', '^SVisual^LoggerLogsList', fuzzyScore);
assertMatches('sllll', 'SVisualLoggerLogsList', '^SVisua^l^Logger^Logs^List', fuzzyScore);
assertMatches('Three', 'HTMLHRElement', undefined, fuzzyScore);
assertMatches('Three', 'Three', '^T^h^r^e^e', fuzzyScore);
assertMatches('fo', 'barfoo', undefined, fuzzyScore);
assertMatches('fo', 'bar_foo', 'bar_^f^oo', fuzzyScore);
assertMatches('fo', 'bar_Foo', 'bar_^F^oo', fuzzyScore);
assertMatches('fo', 'bar foo', 'bar ^f^oo', fuzzyScore);
assertMatches('fo', 'bar.foo', 'bar.^f^oo', fuzzyScore);
assertMatches('fo', 'bar/foo', 'bar/^f^oo', fuzzyScore);
assertMatches('fo', 'bar\\foo', 'bar\\^f^oo', fuzzyScore);
});
test('fuzzyScore (first match can be weak)', function () {
assertMatches('Three', 'HTMLHRElement', 'H^TML^H^R^El^ement', fuzzyScore, { firstMatchCanBeWeak: true });
assertMatches('tor', 'constructor', 'construc^t^o^r', fuzzyScore, { firstMatchCanBeWeak: true });
assertMatches('ur', 'constructor', 'constr^ucto^r', fuzzyScore, { firstMatchCanBeWeak: true });
assertTopScore(fuzzyScore, 'tor', 2, 'constructor', 'Thor', 'cTor');
});
test('fuzzyScore, many matches', function () {
assertMatches(
'aaaaaa',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'^a^a^a^a^a^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
fuzzyScore
);
});
test('Freeze when fjfj -> jfjf, https://github.com/microsoft/vscode/issues/91807', function () {
assertMatches(
'jfjfj',
'fjfjfjfjfjfjfjfjfjfjfj',
undefined, fuzzyScore
);
assertMatches(
'jfjfjfjfjfjfjfjfjfj',
'fjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj',
undefined, fuzzyScore
);
assertMatches(
'jfjfjfjfjfjfjfjfjfjjfjfjfjfjfjfjfjfjfjjfjfjfjfjfjfjfjfjfjjfjfjfjfjfjfjfjfjfjjfjfjfjfjfjfjfjfjfjjfjfjfjfjfjfjfjfjfj',
'fjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj',
undefined, fuzzyScore
);
assertMatches(
'jfjfjfjfjfjfjfjfjfj',
'fJfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj',
'f^J^f^j^f^j^f^j^f^j^f^j^f^j^f^j^f^j^f^jfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj', // strong match
fuzzyScore
);
assertMatches(
'jfjfjfjfjfjfjfjfjfj',
'fjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj',
'f^j^f^j^f^j^f^j^f^j^f^j^f^j^f^j^f^j^f^jfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfjfj', // any match
fuzzyScore, { firstMatchCanBeWeak: true }
);
});
test('fuzzyScore, issue #26423', function () {
assertMatches('baba', 'abababab', undefined, fuzzyScore);
assertMatches(
'fsfsfs',
'dsafdsafdsafdsafdsafdsafdsafasdfdsa',
undefined,
fuzzyScore
);
assertMatches(
'fsfsfsfsfsfsfsf',
'dsafdsafdsafdsafdsafdsafdsafasdfdsafdsafdsafdsafdsfdsafdsfdfdfasdnfdsajfndsjnafjndsajlknfdsa',
undefined,
fuzzyScore
);
});
test('Fuzzy IntelliSense matching vs Haxe metadata completion, #26995', function () {
assertMatches('f', ':Foo', ':^Foo', fuzzyScore);
assertMatches('f', ':foo', ':^foo', fuzzyScore);
});
test('Separator only match should not be weak #79558', function () {
assertMatches('.', 'foo.bar', 'foo^.bar', fuzzyScore);
});
test('Cannot set property \'1\' of undefined, #26511', function () {
const word = new Array<void>(123).join('a');
const pattern = new Array<void>(120).join('a');
fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0);
assert.ok(true); // must not explode
});
test('Vscode 1.12 no longer obeys \'sortText\' in completion items (from language server), #26096', function () {
assertMatches(' ', ' group', undefined, fuzzyScore, { patternPos: 2 });
assertMatches(' g', ' group', ' ^group', fuzzyScore, { patternPos: 2 });
assertMatches('g', ' group', ' ^group', fuzzyScore);
assertMatches('g g', ' groupGroup', undefined, fuzzyScore);
assertMatches('g g', ' group Group', ' ^group^ ^Group', fuzzyScore);
assertMatches(' g g', ' group Group', ' ^group^ ^Group', fuzzyScore, { patternPos: 1 });
assertMatches('zz', 'zzGroup', '^z^zGroup', fuzzyScore);
assertMatches('zzg', 'zzGroup', '^z^z^Group', fuzzyScore);
assertMatches('g', 'zzGroup', 'zz^Group', fuzzyScore);
});
test('patternPos isn\'t working correctly #79815', function () {
assertMatches(':p'.substr(1), 'prop', '^prop', fuzzyScore, { patternPos: 0 });
assertMatches(':p', 'prop', '^prop', fuzzyScore, { patternPos: 1 });
assertMatches(':p', 'prop', undefined, fuzzyScore, { patternPos: 2 });
assertMatches(':p', 'proP', 'pro^P', fuzzyScore, { patternPos: 1, wordPos: 1 });
assertMatches(':p', 'aprop', 'a^prop', fuzzyScore, { patternPos: 1, firstMatchCanBeWeak: true });
assertMatches(':p', 'aprop', undefined, fuzzyScore, { patternPos: 1, firstMatchCanBeWeak: false });
});
function assertTopScore(filter: typeof fuzzyScore, pattern: string, expected: number, ...words: string[]) {
let topScore = -(100 * 10);
let topIdx = 0;
for (let i = 0; i < words.length; i++) {
const word = words[i];
const m = filter(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0);
if (m) {
const [score] = m;
if (score > topScore) {
topScore = score;
topIdx = i;
}
}
}
assert.strictEqual(topIdx, expected, `${pattern} -> actual=${words[topIdx]} <> expected=${words[expected]}`);
}
test('topScore - fuzzyScore', function () {
assertTopScore(fuzzyScore, 'cons', 2, 'ArrayBufferConstructor', 'Console', 'console');
assertTopScore(fuzzyScore, 'Foo', 1, 'foo', 'Foo', 'foo');
// #24904
assertTopScore(fuzzyScore, 'onMess', 1, 'onmessage', 'onMessage', 'onThisMegaEscape');
assertTopScore(fuzzyScore, 'CC', 1, 'camelCase', 'CamelCase');
assertTopScore(fuzzyScore, 'cC', 0, 'camelCase', 'CamelCase');
// assertTopScore(fuzzyScore, 'cC', 1, 'ccfoo', 'camelCase');
// assertTopScore(fuzzyScore, 'cC', 1, 'ccfoo', 'camelCase', 'foo-cC-bar');
// issue #17836
// assertTopScore(fuzzyScore, 'TEdit', 1, 'TextEditorDecorationType', 'TextEdit', 'TextEditor');
assertTopScore(fuzzyScore, 'p', 4, 'parse', 'posix', 'pafdsa', 'path', 'p');
assertTopScore(fuzzyScore, 'pa', 0, 'parse', 'pafdsa', 'path');
// issue #14583
assertTopScore(fuzzyScore, 'log', 3, 'HTMLOptGroupElement', 'ScrollLogicalPosition', 'SVGFEMorphologyElement', 'log', 'logger');
assertTopScore(fuzzyScore, 'e', 2, 'AbstractWorker', 'ActiveXObject', 'else');
// issue #14446
assertTopScore(fuzzyScore, 'workbench.sideb', 1, 'workbench.editor.defaultSideBySideLayout', 'workbench.sideBar.location');
// issue #11423
assertTopScore(fuzzyScore, 'editor.r', 2, 'diffEditor.renderSideBySide', 'editor.overviewRulerlanes', 'editor.renderControlCharacter', 'editor.renderWhitespace');
// assertTopScore(fuzzyScore, 'editor.R', 1, 'diffEditor.renderSideBySide', 'editor.overviewRulerlanes', 'editor.renderControlCharacter', 'editor.renderWhitespace');
// assertTopScore(fuzzyScore, 'Editor.r', 0, 'diffEditor.renderSideBySide', 'editor.overviewRulerlanes', 'editor.renderControlCharacter', 'editor.renderWhitespace');
assertTopScore(fuzzyScore, '-mo', 1, '-ms-ime-mode', '-moz-columns');
// dupe, issue #14861
assertTopScore(fuzzyScore, 'convertModelPosition', 0, 'convertModelPositionToViewPosition', 'convertViewToModelPosition');
// dupe, issue #14942
assertTopScore(fuzzyScore, 'is', 0, 'isValidViewletId', 'import statement');
assertTopScore(fuzzyScore, 'title', 1, 'files.trimTrailingWhitespace', 'window.title');
assertTopScore(fuzzyScore, 'const', 1, 'constructor', 'const', 'cuOnstrul');
});
test('Unexpected suggestion scoring, #28791', function () {
assertTopScore(fuzzyScore, '_lines', 1, '_lineStarts', '_lines');
assertTopScore(fuzzyScore, '_lines', 1, '_lineS', '_lines');
assertTopScore(fuzzyScore, '_lineS', 0, '_lineS', '_lines');
});
test('HTML closing tag proposal filtered out #38880', function () {
assertMatches('\t\t<', '\t\t</body>', '^\t^\t^</body>', fuzzyScore, { patternPos: 0 });
assertMatches('\t\t<', '\t\t</body>', '\t\t^</body>', fuzzyScore, { patternPos: 2 });
assertMatches('\t<', '\t</body>', '\t^</body>', fuzzyScore, { patternPos: 1 });
});
test('fuzzyScoreGraceful', () => {
assertMatches('rlut', 'result', undefined, fuzzyScore);
assertMatches('rlut', 'result', '^res^u^l^t', fuzzyScoreGraceful);
assertMatches('cno', 'console', '^co^ns^ole', fuzzyScore);
assertMatches('cno', 'console', '^co^ns^ole', fuzzyScoreGraceful);
assertMatches('cno', 'console', '^c^o^nsole', fuzzyScoreGracefulAggressive);
assertMatches('cno', 'co_new', '^c^o_^new', fuzzyScoreGraceful);
assertMatches('cno', 'co_new', '^c^o_^new', fuzzyScoreGracefulAggressive);
});
test('List highlight filter: Not all characters from match are highlighterd #66923', () => {
assertMatches('foo', 'barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_foo', 'barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_^f^o^o', fuzzyScore);
});
test('Autocompletion is matched against truncated filterText to 54 characters #74133', () => {
assertMatches(
'foo',
'ffffffffffffffffffffffffffffbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_foo',
'ffffffffffffffffffffffffffffbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_^f^o^o',
fuzzyScore
);
assertMatches(
'Aoo',
'Affffffffffffffffffffffffffffbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_foo',
'^Affffffffffffffffffffffffffffbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_f^o^o',
fuzzyScore
);
assertMatches(
'foo',
'Gffffffffffffffffffffffffffffbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar_foo',
undefined,
fuzzyScore
);
});
test('"Go to Symbol" with the exact method name doesn\'t work as expected #84787', function () {
const match = fuzzyScore(':get', ':get', 1, 'get', 'get', 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
assert.ok(Boolean(match));
});
test('Wrong highlight after emoji #113404', function () {
assertMatches('di', '✨div classname=""></div>', '✨^d^iv classname=""></div>', fuzzyScore);
assertMatches('di', 'adiv classname=""></div>', 'adiv classname=""></^d^iv>', fuzzyScore);
});
test('Suggestion is not highlighted #85826', function () {
assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScore);
assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScoreGracefulAggressive);
});
test('IntelliSense completion not correctly highlighting text in front of cursor #115250', function () {
assertMatches('lo', 'log', '^l^og', fuzzyScore);
assertMatches('.lo', 'log', '^l^og', anyScore);
assertMatches('.', 'log', 'log', anyScore);
});
test('configurable full match boost', function () {
const prefix = 'create';
const a = 'createModelServices';
const b = 'create';
const aBoost = fuzzyScore(prefix, prefix, 0, a, a.toLowerCase(), 0, { boostFullMatch: true, firstMatchCanBeWeak: true });
const bBoost = fuzzyScore(prefix, prefix, 0, b, b.toLowerCase(), 0, { boostFullMatch: true, firstMatchCanBeWeak: true });
assert.ok(aBoost);
assert.ok(bBoost);
assert.ok(aBoost[0] < bBoost[0]);
const aScore = fuzzyScore(prefix, prefix, 0, a, a.toLowerCase(), 0, { boostFullMatch: false, firstMatchCanBeWeak: true });
const bScore = fuzzyScore(prefix, prefix, 0, b, b.toLowerCase(), 0, { boostFullMatch: false, firstMatchCanBeWeak: true });
assert.ok(aScore);
assert.ok(bScore);
assert.ok(aScore[0] === bScore[0]);
});
test('Unexpected suggest highlighting ignores whole word match in favor of matching first letter#147423', function () {
assertMatches('i', 'machine/{id}', 'machine/{^id}', fuzzyScore);
assertMatches('ok', 'obobobf{ok}/user', '^obobobf{o^k}/user', fuzzyScore);
});
});
| src/vs/base/test/common/filters.test.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017045033746398985,
0.00016736511315684766,
0.0001631695922696963,
0.00016763339226599783,
0.0000015010047036412288
]
|
{
"id": 8,
"code_window": [
"const localize = nls.loadMessageBundle();\n",
"\n",
"const settingNames = Object.freeze({\n",
"\tenabled: 'experimental.updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',\n",
"});\n",
"\n",
"const enum UpdateLinksOnFileMoveSetting {\n",
"\tPrompt = 'prompt',\n",
"\tAlways = 'always',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tenabled: 'updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'updateLinksOnFileMove.enableForDirectories',\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 20
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as picomatch from 'picomatch';
import * as vscode from 'vscode';
import { TextDocumentEdit } from 'vscode-languageclient';
import * as nls from 'vscode-nls';
import { MdLanguageClient } from '../client/client';
import { Delayer } from '../util/async';
import { noopToken } from '../util/cancellation';
import { Disposable } from '../util/dispose';
import { looksLikeMarkdownPath } from '../util/file';
import { convertRange } from './fileReferences';
const localize = nls.loadMessageBundle();
const settingNames = Object.freeze({
enabled: 'experimental.updateLinksOnFileMove.enabled',
externalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',
enableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',
});
const enum UpdateLinksOnFileMoveSetting {
Prompt = 'prompt',
Always = 'always',
Never = 'never',
}
interface RenameAction {
readonly oldUri: vscode.Uri;
readonly newUri: vscode.Uri;
}
class UpdateLinksOnFileRenameHandler extends Disposable {
private readonly _delayer = new Delayer(50);
private readonly _pendingRenames = new Set<RenameAction>();
public constructor(
private readonly client: MdLanguageClient,
) {
super();
this._register(vscode.workspace.onDidRenameFiles(async (e) => {
for (const { newUri, oldUri } of e.files) {
const config = vscode.workspace.getConfiguration('markdown', newUri);
if (!await this.shouldParticipateInLinkUpdate(config, newUri)) {
continue;
}
this._pendingRenames.add({ newUri, oldUri });
}
if (this._pendingRenames.size) {
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('renameProgress.title', "Checking for Markdown links to update")
}, () => this.flushRenames());
});
}
}));
}
private async flushRenames(): Promise<void> {
const renames = Array.from(this._pendingRenames);
this._pendingRenames.clear();
const result = await this.getEditsForFileRename(renames, noopToken);
if (result && result.edit.size) {
if (await this.confirmActionWithUser(result.resourcesBeingRenamed)) {
await vscode.workspace.applyEdit(result.edit);
}
}
}
private async confirmActionWithUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
switch (setting) {
case UpdateLinksOnFileMoveSetting.Prompt:
return this.promptUser(newResources);
case UpdateLinksOnFileMoveSetting.Always:
return true;
case UpdateLinksOnFileMoveSetting.Never:
default:
return false;
}
}
private async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
if (setting === UpdateLinksOnFileMoveSetting.Never) {
return false;
}
if (looksLikeMarkdownPath(newUri)) {
return true;
}
const externalGlob = config.get<string>(settingNames.externalFileGlobs);
if (!!externalGlob && picomatch.isMatch(newUri.fsPath, externalGlob)) {
return true;
}
const stat = await vscode.workspace.fs.stat(newUri);
if (stat.type === vscode.FileType.Directory) {
return config.get<boolean>(settingNames.enableForDirectories, true);
}
return false;
}
private async promptUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const rejectItem: vscode.MessageItem = {
title: localize('reject.title', "No"),
isCloseAffordance: true,
};
const acceptItem: vscode.MessageItem = {
title: localize('accept.title', "Yes"),
};
const alwaysItem: vscode.MessageItem = {
title: localize('always.title', "Always automatically update Markdown Links"),
};
const neverItem: vscode.MessageItem = {
title: localize('never.title', "Never automatically update Markdown Links"),
};
const choice = await vscode.window.showInformationMessage(
newResources.length === 1
? localize('prompt', "Update Markdown links for '{0}'?", path.basename(newResources[0].fsPath))
: this.getConfirmMessage(localize('promptMoreThanOne', "Update Markdown link for the following {0} files?", newResources.length), newResources), {
modal: true,
}, rejectItem, acceptItem, alwaysItem, neverItem);
switch (choice) {
case acceptItem: {
return true;
}
case rejectItem: {
return false;
}
case alwaysItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Always,
this.getConfigTargetScope(config, settingNames.enabled));
return true;
}
case neverItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Never,
this.getConfigTargetScope(config, settingNames.enabled));
return false;
}
default: {
return false;
}
}
}
private async getEditsForFileRename(renames: readonly RenameAction[], token: vscode.CancellationToken): Promise<{ edit: vscode.WorkspaceEdit; resourcesBeingRenamed: vscode.Uri[] } | undefined> {
const result = await this.client.getEditForFileRenames(renames.map(rename => ({ oldUri: rename.oldUri.toString(), newUri: rename.newUri.toString() })), token);
if (!result?.edit.documentChanges?.length) {
return undefined;
}
const workspaceEdit = new vscode.WorkspaceEdit();
for (const change of result.edit.documentChanges as TextDocumentEdit[]) {
const uri = vscode.Uri.parse(change.textDocument.uri);
for (const edit of change.edits) {
workspaceEdit.replace(uri, convertRange(edit.range), edit.newText);
}
}
return {
edit: workspaceEdit,
resourcesBeingRenamed: result.participatingRenames.map(x => vscode.Uri.parse(x.newUri)),
};
}
private getConfirmMessage(start: string, resourcesToConfirm: readonly vscode.Uri[]): string {
const MAX_CONFIRM_FILES = 10;
const paths = [start];
paths.push('');
paths.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => path.basename(r.fsPath)));
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
paths.push(localize('moreFile', "...1 additional file not shown"));
} else {
paths.push(localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
}
}
paths.push('');
return paths.join('\n');
}
private getConfigTargetScope(config: vscode.WorkspaceConfiguration, settingsName: string): vscode.ConfigurationTarget {
const inspected = config.inspect(settingsName);
if (inspected?.workspaceFolderValue) {
return vscode.ConfigurationTarget.WorkspaceFolder;
}
if (inspected?.workspaceValue) {
return vscode.ConfigurationTarget.Workspace;
}
return vscode.ConfigurationTarget.Global;
}
}
export function registerUpdateLinksOnRename(client: MdLanguageClient) {
return new UpdateLinksOnFileRenameHandler(client);
}
| extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9990776777267456,
0.33374783396720886,
0.00016926994430832565,
0.0016608827281743288,
0.4692574739456177
]
|
{
"id": 8,
"code_window": [
"const localize = nls.loadMessageBundle();\n",
"\n",
"const settingNames = Object.freeze({\n",
"\tenabled: 'experimental.updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',\n",
"});\n",
"\n",
"const enum UpdateLinksOnFileMoveSetting {\n",
"\tPrompt = 'prompt',\n",
"\tAlways = 'always',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tenabled: 'updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'updateLinksOnFileMove.enableForDirectories',\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 20
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as vscode from 'vscode';
import type * as Proto from '../protocol';
import * as PConst from '../protocol.const';
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
import API from '../utils/api';
import { conditionalRegistration, requireMinVersion, requireSomeCapability } from '../utils/dependentRegistration';
import { DocumentSelector } from '../utils/documentSelector';
import { parseKindModifier } from '../utils/modifiers';
import * as typeConverters from '../utils/typeConverters';
class TypeScriptCallHierarchySupport implements vscode.CallHierarchyProvider {
public static readonly minVersion = API.v380;
public constructor(
private readonly client: ITypeScriptServiceClient
) { }
public async prepareCallHierarchy(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken
): Promise<vscode.CallHierarchyItem | vscode.CallHierarchyItem[] | undefined> {
const filepath = this.client.toOpenedFilePath(document);
if (!filepath) {
return undefined;
}
const args = typeConverters.Position.toFileLocationRequestArgs(filepath, position);
const response = await this.client.execute('prepareCallHierarchy', args, token);
if (response.type !== 'response' || !response.body) {
return undefined;
}
return Array.isArray(response.body)
? response.body.map(fromProtocolCallHierarchyItem)
: fromProtocolCallHierarchyItem(response.body);
}
public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[] | undefined> {
const filepath = this.client.toPath(item.uri);
if (!filepath) {
return undefined;
}
const args = typeConverters.Position.toFileLocationRequestArgs(filepath, item.selectionRange.start);
const response = await this.client.execute('provideCallHierarchyIncomingCalls', args, token);
if (response.type !== 'response' || !response.body) {
return undefined;
}
return response.body.map(fromProtocolCallHierarchyIncomingCall);
}
public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[] | undefined> {
const filepath = this.client.toPath(item.uri);
if (!filepath) {
return undefined;
}
const args = typeConverters.Position.toFileLocationRequestArgs(filepath, item.selectionRange.start);
const response = await this.client.execute('provideCallHierarchyOutgoingCalls', args, token);
if (response.type !== 'response' || !response.body) {
return undefined;
}
return response.body.map(fromProtocolCallHierarchyOutgoingCall);
}
}
function isSourceFileItem(item: Proto.CallHierarchyItem) {
return item.kind === PConst.Kind.script || item.kind === PConst.Kind.module && item.selectionSpan.start.line === 1 && item.selectionSpan.start.offset === 1;
}
function fromProtocolCallHierarchyItem(item: Proto.CallHierarchyItem): vscode.CallHierarchyItem {
const useFileName = isSourceFileItem(item);
const name = useFileName ? path.basename(item.file) : item.name;
const detail = useFileName ? vscode.workspace.asRelativePath(path.dirname(item.file)) : item.containerName ?? '';
const result = new vscode.CallHierarchyItem(
typeConverters.SymbolKind.fromProtocolScriptElementKind(item.kind),
name,
detail,
vscode.Uri.file(item.file),
typeConverters.Range.fromTextSpan(item.span),
typeConverters.Range.fromTextSpan(item.selectionSpan)
);
const kindModifiers = item.kindModifiers ? parseKindModifier(item.kindModifiers) : undefined;
if (kindModifiers?.has(PConst.KindModifiers.deprecated)) {
result.tags = [vscode.SymbolTag.Deprecated];
}
return result;
}
function fromProtocolCallHierarchyIncomingCall(item: Proto.CallHierarchyIncomingCall): vscode.CallHierarchyIncomingCall {
return new vscode.CallHierarchyIncomingCall(
fromProtocolCallHierarchyItem(item.from),
item.fromSpans.map(typeConverters.Range.fromTextSpan)
);
}
function fromProtocolCallHierarchyOutgoingCall(item: Proto.CallHierarchyOutgoingCall): vscode.CallHierarchyOutgoingCall {
return new vscode.CallHierarchyOutgoingCall(
fromProtocolCallHierarchyItem(item.to),
item.fromSpans.map(typeConverters.Range.fromTextSpan)
);
}
export function register(
selector: DocumentSelector,
client: ITypeScriptServiceClient
) {
return conditionalRegistration([
requireMinVersion(client, TypeScriptCallHierarchySupport.minVersion),
requireSomeCapability(client, ClientCapability.Semantic),
], () => {
return vscode.languages.registerCallHierarchyProvider(selector.semantic,
new TypeScriptCallHierarchySupport(client));
});
}
| extensions/typescript-language-features/src/languageFeatures/callHierarchy.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001772026007529348,
0.0001734007673803717,
0.00016499683260917664,
0.00017385750834364444,
0.0000030345759114425164
]
|
{
"id": 8,
"code_window": [
"const localize = nls.loadMessageBundle();\n",
"\n",
"const settingNames = Object.freeze({\n",
"\tenabled: 'experimental.updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',\n",
"});\n",
"\n",
"const enum UpdateLinksOnFileMoveSetting {\n",
"\tPrompt = 'prompt',\n",
"\tAlways = 'always',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tenabled: 'updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'updateLinksOnFileMove.enableForDirectories',\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 20
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as dom from 'vs/base/browser/dom';
import { addMatchMediaChangeListener } from 'vs/base/browser/browser';
import { Color } from 'vs/base/common/color';
import { Emitter } from 'vs/base/common/event';
import { TokenizationRegistry } from 'vs/editor/common/languages';
import { FontStyle, TokenMetadata } from 'vs/editor/common/encodedTokenAttributes';
import { ITokenThemeRule, TokenTheme, generateTokensCSSForColorMap } from 'vs/editor/common/languages/supports/tokenization';
import { BuiltinTheme, IStandaloneTheme, IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneTheme';
import { hc_black, hc_light, vs, vs_dark } from 'vs/editor/standalone/common/themes';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { Registry } from 'vs/platform/registry/common/platform';
import { asCssVariableName, ColorIdentifier, Extensions, IColorRegistry } from 'vs/platform/theme/common/colorRegistry';
import { Extensions as ThemingExtensions, ICssStyleCollector, IFileIconTheme, IProductIconTheme, IThemingRegistry, ITokenStyle } from 'vs/platform/theme/common/themeService';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { ColorScheme, isDark, isHighContrast } from 'vs/platform/theme/common/theme';
import { getIconsStyleSheet, UnthemedProductIconTheme } from 'vs/platform/theme/browser/iconsStyleSheet';
export const VS_LIGHT_THEME_NAME = 'vs';
export const VS_DARK_THEME_NAME = 'vs-dark';
export const HC_BLACK_THEME_NAME = 'hc-black';
export const HC_LIGHT_THEME_NAME = 'hc-light';
const colorRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
const themingRegistry = Registry.as<IThemingRegistry>(ThemingExtensions.ThemingContribution);
class StandaloneTheme implements IStandaloneTheme {
public readonly id: string;
public readonly themeName: string;
private readonly themeData: IStandaloneThemeData;
private colors: Map<string, Color> | null;
private readonly defaultColors: { [colorId: string]: Color | undefined };
private _tokenTheme: TokenTheme | null;
constructor(name: string, standaloneThemeData: IStandaloneThemeData) {
this.themeData = standaloneThemeData;
const base = standaloneThemeData.base;
if (name.length > 0) {
if (isBuiltinTheme(name)) {
this.id = name;
} else {
this.id = base + ' ' + name;
}
this.themeName = name;
} else {
this.id = base;
this.themeName = base;
}
this.colors = null;
this.defaultColors = Object.create(null);
this._tokenTheme = null;
}
public get label(): string {
return this.themeName;
}
public get base(): string {
return this.themeData.base;
}
public notifyBaseUpdated() {
if (this.themeData.inherit) {
this.colors = null;
this._tokenTheme = null;
}
}
private getColors(): Map<string, Color> {
if (!this.colors) {
const colors = new Map<string, Color>();
for (const id in this.themeData.colors) {
colors.set(id, Color.fromHex(this.themeData.colors[id]));
}
if (this.themeData.inherit) {
const baseData = getBuiltinRules(this.themeData.base);
for (const id in baseData.colors) {
if (!colors.has(id)) {
colors.set(id, Color.fromHex(baseData.colors[id]));
}
}
}
this.colors = colors;
}
return this.colors;
}
public getColor(colorId: ColorIdentifier, useDefault?: boolean): Color | undefined {
const color = this.getColors().get(colorId);
if (color) {
return color;
}
if (useDefault !== false) {
return this.getDefault(colorId);
}
return undefined;
}
private getDefault(colorId: ColorIdentifier): Color | undefined {
let color = this.defaultColors[colorId];
if (color) {
return color;
}
color = colorRegistry.resolveDefaultColor(colorId, this);
this.defaultColors[colorId] = color;
return color;
}
public defines(colorId: ColorIdentifier): boolean {
return Object.prototype.hasOwnProperty.call(this.getColors(), colorId);
}
public get type(): ColorScheme {
switch (this.base) {
case VS_LIGHT_THEME_NAME: return ColorScheme.LIGHT;
case HC_BLACK_THEME_NAME: return ColorScheme.HIGH_CONTRAST_DARK;
case HC_LIGHT_THEME_NAME: return ColorScheme.HIGH_CONTRAST_LIGHT;
default: return ColorScheme.DARK;
}
}
public get tokenTheme(): TokenTheme {
if (!this._tokenTheme) {
let rules: ITokenThemeRule[] = [];
let encodedTokensColors: string[] = [];
if (this.themeData.inherit) {
const baseData = getBuiltinRules(this.themeData.base);
rules = baseData.rules;
if (baseData.encodedTokensColors) {
encodedTokensColors = baseData.encodedTokensColors;
}
}
// Pick up default colors from `editor.foreground` and `editor.background` if available
const editorForeground = this.themeData.colors['editor.foreground'];
const editorBackground = this.themeData.colors['editor.background'];
if (editorForeground || editorBackground) {
const rule: ITokenThemeRule = { token: '' };
if (editorForeground) {
rule.foreground = editorForeground;
}
if (editorBackground) {
rule.background = editorBackground;
}
rules.push(rule);
}
rules = rules.concat(this.themeData.rules);
if (this.themeData.encodedTokensColors) {
encodedTokensColors = this.themeData.encodedTokensColors;
}
this._tokenTheme = TokenTheme.createFromRawTokenTheme(rules, encodedTokensColors);
}
return this._tokenTheme;
}
public getTokenStyleMetadata(type: string, modifiers: string[], modelLanguage: string): ITokenStyle | undefined {
// use theme rules match
const style = this.tokenTheme._match([type].concat(modifiers).join('.'));
const metadata = style.metadata;
const foreground = TokenMetadata.getForeground(metadata);
const fontStyle = TokenMetadata.getFontStyle(metadata);
return {
foreground: foreground,
italic: Boolean(fontStyle & FontStyle.Italic),
bold: Boolean(fontStyle & FontStyle.Bold),
underline: Boolean(fontStyle & FontStyle.Underline),
strikethrough: Boolean(fontStyle & FontStyle.Strikethrough)
};
}
public get tokenColorMap(): string[] {
return [];
}
public readonly semanticHighlighting = false;
}
function isBuiltinTheme(themeName: string): themeName is BuiltinTheme {
return (
themeName === VS_LIGHT_THEME_NAME
|| themeName === VS_DARK_THEME_NAME
|| themeName === HC_BLACK_THEME_NAME
|| themeName === HC_LIGHT_THEME_NAME
);
}
function getBuiltinRules(builtinTheme: BuiltinTheme): IStandaloneThemeData {
switch (builtinTheme) {
case VS_LIGHT_THEME_NAME:
return vs;
case VS_DARK_THEME_NAME:
return vs_dark;
case HC_BLACK_THEME_NAME:
return hc_black;
case HC_LIGHT_THEME_NAME:
return hc_light;
}
}
function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme {
const themeData = getBuiltinRules(builtinTheme);
return new StandaloneTheme(builtinTheme, themeData);
}
export class StandaloneThemeService extends Disposable implements IStandaloneThemeService {
declare readonly _serviceBrand: undefined;
private readonly _onColorThemeChange = this._register(new Emitter<IStandaloneTheme>());
public readonly onDidColorThemeChange = this._onColorThemeChange.event;
private readonly _onFileIconThemeChange = this._register(new Emitter<IFileIconTheme>());
public readonly onDidFileIconThemeChange = this._onFileIconThemeChange.event;
private readonly _onProductIconThemeChange = this._register(new Emitter<IProductIconTheme>());
public readonly onDidProductIconThemeChange = this._onProductIconThemeChange.event;
private readonly _environment: IEnvironmentService = Object.create(null);
private readonly _knownThemes: Map<string, StandaloneTheme>;
private _autoDetectHighContrast: boolean;
private _codiconCSS: string;
private _themeCSS: string;
private _allCSS: string;
private _globalStyleElement: HTMLStyleElement | null;
private _styleElements: HTMLStyleElement[];
private _colorMapOverride: Color[] | null;
private _theme!: IStandaloneTheme;
private _builtInProductIconTheme = new UnthemedProductIconTheme();
constructor() {
super();
this._autoDetectHighContrast = true;
this._knownThemes = new Map<string, StandaloneTheme>();
this._knownThemes.set(VS_LIGHT_THEME_NAME, newBuiltInTheme(VS_LIGHT_THEME_NAME));
this._knownThemes.set(VS_DARK_THEME_NAME, newBuiltInTheme(VS_DARK_THEME_NAME));
this._knownThemes.set(HC_BLACK_THEME_NAME, newBuiltInTheme(HC_BLACK_THEME_NAME));
this._knownThemes.set(HC_LIGHT_THEME_NAME, newBuiltInTheme(HC_LIGHT_THEME_NAME));
const iconsStyleSheet = getIconsStyleSheet(this);
this._codiconCSS = iconsStyleSheet.getCSS();
this._themeCSS = '';
this._allCSS = `${this._codiconCSS}\n${this._themeCSS}`;
this._globalStyleElement = null;
this._styleElements = [];
this._colorMapOverride = null;
this.setTheme(VS_LIGHT_THEME_NAME);
this._onOSSchemeChanged();
iconsStyleSheet.onDidChange(() => {
this._codiconCSS = iconsStyleSheet.getCSS();
this._updateCSS();
});
addMatchMediaChangeListener('(forced-colors: active)', () => {
this._onOSSchemeChanged();
});
}
public registerEditorContainer(domNode: HTMLElement): IDisposable {
if (dom.isInShadowDOM(domNode)) {
return this._registerShadowDomContainer(domNode);
}
return this._registerRegularEditorContainer();
}
private _registerRegularEditorContainer(): IDisposable {
if (!this._globalStyleElement) {
this._globalStyleElement = dom.createStyleSheet();
this._globalStyleElement.className = 'monaco-colors';
this._globalStyleElement.textContent = this._allCSS;
this._styleElements.push(this._globalStyleElement);
}
return Disposable.None;
}
private _registerShadowDomContainer(domNode: HTMLElement): IDisposable {
const styleElement = dom.createStyleSheet(domNode);
styleElement.className = 'monaco-colors';
styleElement.textContent = this._allCSS;
this._styleElements.push(styleElement);
return {
dispose: () => {
for (let i = 0; i < this._styleElements.length; i++) {
if (this._styleElements[i] === styleElement) {
this._styleElements.splice(i, 1);
return;
}
}
}
};
}
public defineTheme(themeName: string, themeData: IStandaloneThemeData): void {
if (!/^[a-z0-9\-]+$/i.test(themeName)) {
throw new Error('Illegal theme name!');
}
if (!isBuiltinTheme(themeData.base) && !isBuiltinTheme(themeName)) {
throw new Error('Illegal theme base!');
}
// set or replace theme
this._knownThemes.set(themeName, new StandaloneTheme(themeName, themeData));
if (isBuiltinTheme(themeName)) {
this._knownThemes.forEach(theme => {
if (theme.base === themeName) {
theme.notifyBaseUpdated();
}
});
}
if (this._theme.themeName === themeName) {
this.setTheme(themeName); // refresh theme
}
}
public getColorTheme(): IStandaloneTheme {
return this._theme;
}
public setColorMapOverride(colorMapOverride: Color[] | null): void {
this._colorMapOverride = colorMapOverride;
this._updateThemeOrColorMap();
}
public setTheme(themeName: string): void {
let theme: StandaloneTheme | undefined;
if (this._knownThemes.has(themeName)) {
theme = this._knownThemes.get(themeName);
} else {
theme = this._knownThemes.get(VS_LIGHT_THEME_NAME);
}
this._updateActualTheme(theme);
}
private _updateActualTheme(desiredTheme: IStandaloneTheme | undefined): void {
if (!desiredTheme || this._theme === desiredTheme) {
// Nothing to do
return;
}
this._theme = desiredTheme;
this._updateThemeOrColorMap();
}
private _onOSSchemeChanged() {
if (this._autoDetectHighContrast) {
const wantsHighContrast = window.matchMedia(`(forced-colors: active)`).matches;
if (wantsHighContrast !== isHighContrast(this._theme.type)) {
// switch to high contrast or non-high contrast but stick to dark or light
let newThemeName;
if (isDark(this._theme.type)) {
newThemeName = wantsHighContrast ? HC_BLACK_THEME_NAME : VS_DARK_THEME_NAME;
} else {
newThemeName = wantsHighContrast ? HC_LIGHT_THEME_NAME : VS_LIGHT_THEME_NAME;
}
this._updateActualTheme(this._knownThemes.get(newThemeName));
}
}
}
public setAutoDetectHighContrast(autoDetectHighContrast: boolean): void {
this._autoDetectHighContrast = autoDetectHighContrast;
this._onOSSchemeChanged();
}
private _updateThemeOrColorMap(): void {
const cssRules: string[] = [];
const hasRule: { [rule: string]: boolean } = {};
const ruleCollector: ICssStyleCollector = {
addRule: (rule: string) => {
if (!hasRule[rule]) {
cssRules.push(rule);
hasRule[rule] = true;
}
}
};
themingRegistry.getThemingParticipants().forEach(p => p(this._theme, ruleCollector, this._environment));
const colorVariables: string[] = [];
for (const item of colorRegistry.getColors()) {
const color = this._theme.getColor(item.id, true);
if (color) {
colorVariables.push(`${asCssVariableName(item.id)}: ${color.toString()};`);
}
}
ruleCollector.addRule(`.monaco-editor { ${colorVariables.join('\n')} }`);
const colorMap = this._colorMapOverride || this._theme.tokenTheme.getColorMap();
ruleCollector.addRule(generateTokensCSSForColorMap(colorMap));
this._themeCSS = cssRules.join('\n');
this._updateCSS();
TokenizationRegistry.setColorMap(colorMap);
this._onColorThemeChange.fire(this._theme);
}
private _updateCSS(): void {
this._allCSS = `${this._codiconCSS}\n${this._themeCSS}`;
this._styleElements.forEach(styleElement => styleElement.textContent = this._allCSS);
}
public getFileIconTheme(): IFileIconTheme {
return {
hasFileIcons: false,
hasFolderIcons: false,
hidesExplorerArrows: false
};
}
public getProductIconTheme(): IProductIconTheme {
return this._builtInProductIconTheme;
}
}
| src/vs/editor/standalone/browser/standaloneThemeService.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017812466830946505,
0.00017418951028957963,
0.00016451046394649893,
0.00017414402100257576,
0.000002564089982115547
]
|
{
"id": 8,
"code_window": [
"const localize = nls.loadMessageBundle();\n",
"\n",
"const settingNames = Object.freeze({\n",
"\tenabled: 'experimental.updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',\n",
"});\n",
"\n",
"const enum UpdateLinksOnFileMoveSetting {\n",
"\tPrompt = 'prompt',\n",
"\tAlways = 'always',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tenabled: 'updateLinksOnFileMove.enabled',\n",
"\texternalFileGlobs: 'updateLinksOnFileMove.externalFileGlobs',\n",
"\tenableForDirectories: 'updateLinksOnFileMove.enableForDirectories',\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 20
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as cp from 'child_process';
let tag = '';
try {
tag = cp
.execSync('git describe --tags `git rev-list --tags --max-count=1`')
.toString()
.trim();
if (!isValidTag(tag)) {
throw Error(`Invalid tag ${tag}`);
}
} catch (err) {
console.error(err);
console.error('Failed to update types');
process.exit(1);
}
function isValidTag(t: string) {
if (t.split('.').length !== 3) {
return false;
}
const [major, minor, bug] = t.split('.');
// Only release for tags like 1.34.0
if (bug !== '0') {
return false;
}
if (isNaN(parseInt(major, 10)) || isNaN(parseInt(minor, 10))) {
return false;
}
return true;
}
| build/azure-pipelines/publish-types/check-version.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00018059137801174074,
0.00017574137018527836,
0.00017228975775651634,
0.00017520297842565924,
0.0000026982463623426156
]
|
{
"id": 9,
"code_window": [
"\t\tsuper();\n",
"\n",
"\t\tthis._register(vscode.workspace.onDidRenameFiles(async (e) => {\n",
"\t\t\tfor (const { newUri, oldUri } of e.files) {\n",
"\t\t\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n",
"\t\t\t\tif (!await this.shouldParticipateInLinkUpdate(config, newUri)) {\n",
"\t\t\t\t\tcontinue;\n",
"\t\t\t\t}\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep"
],
"after_edit": [
"\t\t\tawait Promise.all(e.files.map(async (rename) => {\n",
"\t\t\t\tif (await this.shouldParticipateInLinkUpdate(rename.newUri)) {\n",
"\t\t\t\t\tthis._pendingRenames.add(rename);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 47
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001882680517155677,
0.00016889908874873072,
0.00016158600919879973,
0.00016640705871395767,
0.000006115630185377086
]
|
{
"id": 9,
"code_window": [
"\t\tsuper();\n",
"\n",
"\t\tthis._register(vscode.workspace.onDidRenameFiles(async (e) => {\n",
"\t\t\tfor (const { newUri, oldUri } of e.files) {\n",
"\t\t\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n",
"\t\t\t\tif (!await this.shouldParticipateInLinkUpdate(config, newUri)) {\n",
"\t\t\t\t\tcontinue;\n",
"\t\t\t\t}\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep"
],
"after_edit": [
"\t\t\tawait Promise.all(e.files.map(async (rename) => {\n",
"\t\t\t\tif (await this.shouldParticipateInLinkUpdate(rename.newUri)) {\n",
"\t\t\t\t\tthis._pendingRenames.add(rename);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 47
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { Emitter } from 'vs/base/common/event';
import { ISettableObservable, autorun, derived, ITransaction, observableFromEvent, observableValue, transaction } from 'vs/base/common/observable';
import { BaseObservable, IObservable, IObserver } from 'vs/base/common/observableImpl/base';
suite('observable integration', () => {
test('basic observable + autorun', () => {
const log = new Log();
const observable = observableValue('MyObservableValue', 0);
autorun('MyAutorun', (reader) => {
log.log(`value: ${observable.read(reader)}`);
});
assert.deepStrictEqual(log.getAndClearEntries(), ['value: 0']);
observable.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), ['value: 1']);
observable.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), []);
transaction((tx) => {
observable.set(2, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
observable.set(3, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
});
assert.deepStrictEqual(log.getAndClearEntries(), ['value: 3']);
});
test('basic computed + autorun', () => {
const log = new Log();
const observable1 = observableValue('MyObservableValue1', 0);
const observable2 = observableValue('MyObservableValue2', 0);
const computed = derived('computed', (reader) => {
const value1 = observable1.read(reader);
const value2 = observable2.read(reader);
const sum = value1 + value2;
log.log(`recompute: ${value1} + ${value2} = ${sum}`);
return sum;
});
autorun('MyAutorun', (reader) => {
log.log(`value: ${computed.read(reader)}`);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: 0 + 0 = 0',
'value: 0',
]);
observable1.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: 1 + 0 = 1',
'value: 1',
]);
observable2.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: 1 + 1 = 2',
'value: 2',
]);
transaction((tx) => {
observable1.set(5, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
observable2.set(5, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: 5 + 5 = 10',
'value: 10',
]);
transaction((tx) => {
observable1.set(6, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
observable2.set(4, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
});
assert.deepStrictEqual(log.getAndClearEntries(), ['recompute: 6 + 4 = 10']);
});
test('read during transaction', () => {
const log = new Log();
const observable1 = observableValue('MyObservableValue1', 0);
const observable2 = observableValue('MyObservableValue2', 0);
const computed = derived('computed', (reader) => {
const value1 = observable1.read(reader);
const value2 = observable2.read(reader);
const sum = value1 + value2;
log.log(`recompute: ${value1} + ${value2} = ${sum}`);
return sum;
});
autorun('MyAutorun', (reader) => {
log.log(`value: ${computed.read(reader)}`);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: 0 + 0 = 0',
'value: 0',
]);
log.log(`computed is ${computed.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), ['computed is 0']);
transaction((tx) => {
observable1.set(-1, tx);
log.log(`computed is ${computed.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: -1 + 0 = -1',
'computed is -1',
]);
log.log(`computed is ${computed.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), ['computed is -1']);
observable2.set(1, tx);
assert.deepStrictEqual(log.getAndClearEntries(), []);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute: -1 + 1 = 0',
'value: 0',
]);
});
test('topological order', () => {
const log = new Log();
const observable1 = observableValue('MyObservableValue1', 0);
const observable2 = observableValue('MyObservableValue2', 0);
const computed1 = derived('computed1', (reader) => {
const value1 = observable1.read(reader);
const value2 = observable2.read(reader);
const sum = value1 + value2;
log.log(`recompute1: ${value1} + ${value2} = ${sum}`);
return sum;
});
const computed2 = derived('computed2', (reader) => {
const value1 = computed1.read(reader);
const value2 = observable1.read(reader);
const value3 = observable2.read(reader);
const sum = value1 + value2 + value3;
log.log(`recompute2: ${value1} + ${value2} + ${value3} = ${sum}`);
return sum;
});
const computed3 = derived('computed3', (reader) => {
const value1 = computed2.read(reader);
const value2 = observable1.read(reader);
const value3 = observable2.read(reader);
const sum = value1 + value2 + value3;
log.log(`recompute3: ${value1} + ${value2} + ${value3} = ${sum}`);
return sum;
});
autorun('MyAutorun', (reader) => {
log.log(`value: ${computed3.read(reader)}`);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 0 + 0 = 0',
'recompute2: 0 + 0 + 0 = 0',
'recompute3: 0 + 0 + 0 = 0',
'value: 0',
]);
observable1.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 1 + 0 = 1',
'recompute2: 1 + 1 + 0 = 2',
'recompute3: 2 + 1 + 0 = 3',
'value: 3',
]);
transaction((tx) => {
observable1.set(2, tx);
log.log(`computed2: ${computed2.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 2 + 0 = 2',
'recompute2: 2 + 2 + 0 = 4',
'computed2: 4',
]);
observable1.set(3, tx);
log.log(`computed2: ${computed2.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 3 + 0 = 3',
'recompute2: 3 + 3 + 0 = 6',
'computed2: 6',
]);
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute3: 6 + 3 + 0 = 9',
'value: 9',
]);
});
test('self-disposing autorun', () => {
const log = new Log();
const observable1 = new LoggingObservableValue('MyObservableValue1', 0, log);
const observable2 = new LoggingObservableValue('MyObservableValue2', 0, log);
const observable3 = new LoggingObservableValue('MyObservableValue3', 0, log);
const d = autorun('autorun', (reader) => {
if (observable1.read(reader) >= 2) {
observable2.read(reader);
d.dispose();
observable3.read(reader);
}
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'MyObservableValue1.firstObserverAdded',
'MyObservableValue1.get',
]);
observable1.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'MyObservableValue1.set (value 1)',
'MyObservableValue1.get',
]);
observable1.set(2, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'MyObservableValue1.set (value 2)',
'MyObservableValue1.get',
'MyObservableValue2.firstObserverAdded',
'MyObservableValue2.get',
'MyObservableValue1.lastObserverRemoved',
'MyObservableValue2.lastObserverRemoved',
'MyObservableValue3.get',
]);
});
test('from event', () => {
const log = new Log();
let value = 0;
const eventEmitter = new Emitter<void>();
let id = 0;
const observable = observableFromEvent(
(handler) => {
const curId = id++;
log.log(`subscribed handler ${curId}`);
const disposable = eventEmitter.event(handler);
return {
dispose: () => {
log.log(`unsubscribed handler ${curId}`);
disposable.dispose();
},
};
},
() => {
log.log(`compute value ${value}`);
return value;
}
);
assert.deepStrictEqual(log.getAndClearEntries(), []);
log.log(`get value: ${observable.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'compute value 0',
'get value: 0',
]);
log.log(`get value: ${observable.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'compute value 0',
'get value: 0',
]);
const shouldReadObservable = observableValue('shouldReadObservable', true);
const autorunDisposable = autorun('MyAutorun', (reader) => {
if (shouldReadObservable.read(reader)) {
observable.read(reader);
log.log(
`autorun, should read: true, value: ${observable.read(reader)}`
);
} else {
log.log(`autorun, should read: false`);
}
});
assert.deepStrictEqual(log.getAndClearEntries(), [
'subscribed handler 0',
'compute value 0',
'autorun, should read: true, value: 0',
]);
log.log(`get value: ${observable.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), ['get value: 0']);
value = 1;
eventEmitter.fire();
assert.deepStrictEqual(log.getAndClearEntries(), [
'compute value 1',
'autorun, should read: true, value: 1',
]);
shouldReadObservable.set(false, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'autorun, should read: false',
'unsubscribed handler 0',
]);
shouldReadObservable.set(true, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), [
'subscribed handler 1',
'compute value 1',
'autorun, should read: true, value: 1',
]);
autorunDisposable.dispose();
assert.deepStrictEqual(log.getAndClearEntries(), [
'unsubscribed handler 1',
]);
});
test('get without observers', () => {
// Maybe this scenario should not be supported.
const log = new Log();
const observable1 = observableValue('MyObservableValue1', 0);
const computed1 = derived('computed', (reader) => {
const value1 = observable1.read(reader);
const result = value1 % 3;
log.log(`recompute1: ${value1} % 3 = ${result}`);
return result;
});
const computed2 = derived('computed', (reader) => {
const value1 = computed1.read(reader);
const result = value1 * 2;
log.log(`recompute2: ${value1} * 2 = ${result}`);
return result;
});
const computed3 = derived('computed', (reader) => {
const value1 = computed1.read(reader);
const result = value1 * 3;
log.log(`recompute3: ${value1} * 3 = ${result}`);
return result;
});
const computedSum = derived('computed', (reader) => {
const value1 = computed2.read(reader);
const value2 = computed3.read(reader);
const result = value1 + value2;
log.log(`recompute4: ${value1} + ${value2} = ${result}`);
return result;
});
assert.deepStrictEqual(log.getAndClearEntries(), []);
observable1.set(1, undefined);
assert.deepStrictEqual(log.getAndClearEntries(), []);
log.log(`value: ${computedSum.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 1 % 3 = 1',
'recompute2: 1 * 2 = 2',
'recompute3: 1 * 3 = 3',
'recompute4: 2 + 3 = 5',
'value: 5',
]);
log.log(`value: ${computedSum.get()}`);
assert.deepStrictEqual(log.getAndClearEntries(), [
'recompute1: 1 % 3 = 1',
'recompute2: 1 * 2 = 2',
'recompute3: 1 * 3 = 3',
'recompute4: 2 + 3 = 5',
'value: 5',
]);
});
});
suite('observable details', () => {
test('1', () => {
const log = new Log();
const shouldReadObservable = observableValue('shouldReadObservable', true);
const observable = new LoggingObservableValue('observable', 0, log);
const computed = derived('test', reader => {
if (shouldReadObservable.read(reader)) {
return observable.read(reader) * 2;
}
return 1;
});
autorun('test', reader => {
const value = computed.read(reader);
log.log(`autorun: ${value}`);
});
assert.deepStrictEqual(log.getAndClearEntries(), (["observable.firstObserverAdded", "observable.get", "autorun: 0"]));
transaction(tx => {
observable.set(1, tx);
assert.deepStrictEqual(log.getAndClearEntries(), (["observable.set (value 1)"]));
shouldReadObservable.set(false, tx);
assert.deepStrictEqual(log.getAndClearEntries(), ([]));
computed.get();
assert.deepStrictEqual(log.getAndClearEntries(), (["observable.lastObserverRemoved"]));
});
assert.deepStrictEqual(log.getAndClearEntries(), (["autorun: 1"]));
});
});
export class LoggingObserver implements IObserver {
private count = 0;
constructor(public readonly debugName: string, private readonly log: Log) {
}
beginUpdate<T>(observable: IObservable<T, void>): void {
this.count++;
this.log.log(`${this.debugName}.beginUpdate (count ${this.count})`);
}
handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void {
this.log.log(`${this.debugName}.handleChange (count ${this.count})`);
}
endUpdate<T>(observable: IObservable<T, void>): void {
this.log.log(`${this.debugName}.endUpdate (count ${this.count})`);
this.count--;
}
}
export class LoggingObservableValue<T, TChange = void>
extends BaseObservable<T, TChange>
implements ISettableObservable<T, TChange>
{
private value: T;
constructor(public readonly debugName: string, initialValue: T, private readonly log: Log) {
super();
this.value = initialValue;
}
protected override onFirstObserverAdded(): void {
this.log.log(`${this.debugName}.firstObserverAdded`);
}
protected override onLastObserverRemoved(): void {
this.log.log(`${this.debugName}.lastObserverRemoved`);
}
public get(): T {
this.log.log(`${this.debugName}.get`);
return this.value;
}
public set(value: T, tx: ITransaction | undefined, change: TChange): void {
if (this.value === value) {
return;
}
if (!tx) {
transaction((tx) => {
this.set(value, tx, change);
}, () => `Setting ${this.debugName}`);
return;
}
this.log.log(`${this.debugName}.set (value ${value})`);
this.value = value;
for (const observer of this.observers) {
tx.updateObserver(observer, this);
observer.handleChange(this, change);
}
}
override toString(): string {
return `${this.debugName}: ${this.value}`;
}
}
class Log {
private readonly entries: string[] = [];
public log(message: string): void {
this.entries.push(message);
}
public getAndClearEntries(): string[] {
const entries = [...this.entries];
this.entries.length = 0;
return entries;
}
}
| src/vs/base/test/common/observable.test.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00018014819943346083,
0.0001748681243043393,
0.00016179074009414762,
0.0001755432749632746,
0.000003150466909573879
]
|
{
"id": 9,
"code_window": [
"\t\tsuper();\n",
"\n",
"\t\tthis._register(vscode.workspace.onDidRenameFiles(async (e) => {\n",
"\t\t\tfor (const { newUri, oldUri } of e.files) {\n",
"\t\t\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n",
"\t\t\t\tif (!await this.shouldParticipateInLinkUpdate(config, newUri)) {\n",
"\t\t\t\t\tcontinue;\n",
"\t\t\t\t}\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep"
],
"after_edit": [
"\t\t\tawait Promise.all(e.files.map(async (rename) => {\n",
"\t\t\t\tif (await this.shouldParticipateInLinkUpdate(rename.newUri)) {\n",
"\t\t\t\t\tthis._pendingRenames.add(rename);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 47
} | {
"name": "go",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"engines": {
"vscode": "*"
},
"scripts": {
"update-grammar": "node ../node_modules/vscode-grammar-updater/bin jeff-hykin/better-go-syntax export/generated.tmLanguage.json ./syntaxes/go.tmLanguage.json"
},
"contributes": {
"languages": [
{
"id": "go",
"extensions": [
".go"
],
"aliases": [
"Go"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "go",
"scopeName": "source.go",
"path": "./syntaxes/go.tmLanguage.json"
}
],
"configurationDefaults": {
"[go]": {
"editor.insertSpaces": false
}
}
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/go/package.json | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001782529434422031,
0.00017240918532479554,
0.0001660105917835608,
0.00017368285625707358,
0.000004130352863285225
]
|
{
"id": 9,
"code_window": [
"\t\tsuper();\n",
"\n",
"\t\tthis._register(vscode.workspace.onDidRenameFiles(async (e) => {\n",
"\t\t\tfor (const { newUri, oldUri } of e.files) {\n",
"\t\t\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n",
"\t\t\t\tif (!await this.shouldParticipateInLinkUpdate(config, newUri)) {\n",
"\t\t\t\t\tcontinue;\n",
"\t\t\t\t}\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep"
],
"after_edit": [
"\t\t\tawait Promise.all(e.files.map(async (rename) => {\n",
"\t\t\t\tif (await this.shouldParticipateInLinkUpdate(rename.newUri)) {\n",
"\t\t\t\t\tthis._pendingRenames.add(rename);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 47
} | [
{
"c": "#",
"t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp punctuation.definition.directive.cpp",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0",
"hc_light": "keyword.control: #B5200D"
}
},
{
"c": "define",
"t": "source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0",
"hc_light": "keyword.control: #B5200D"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "DOCTEST_IMPLEMENT_FIXTURE",
"t": "source.cpp meta.preprocessor.macro.cpp entity.name.function.preprocessor.cpp",
"r": {
"dark_plus": "entity.name.function.preprocessor: #569CD6",
"light_plus": "entity.name.function.preprocessor: #0000FF",
"dark_vs": "entity.name.function.preprocessor: #569CD6",
"light_vs": "entity.name.function.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function.preprocessor: #0F4A85"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp punctuation.definition.parameters.begin.preprocessor.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "der",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp variable.parameter.preprocessor.cpp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": ",",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp punctuation.separator.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "base",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp variable.parameter.preprocessor.cpp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": ",",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp punctuation.separator.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "func",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp variable.parameter.preprocessor.cpp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": ",",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp punctuation.separator.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "decorators",
"t": "source.cpp meta.preprocessor.macro.cpp meta.function.preprocessor.parameters.cpp variable.parameter.preprocessor.cpp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp punctuation.definition.parameters.end.preprocessor.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "namespace",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.head.namespace.cpp keyword.other.namespace.definition.cpp storage.type.namespace.definition.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.head.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "{",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.head.namespace.cpp punctuation.section.block.begin.bracket.curly.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "struct",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp storage.type.struct.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "der",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp entity.name.type.struct.cpp",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
"light_plus": "entity.name.type: #267F99",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.type: #4EC9B0",
"hc_light": "entity.name.type: #185E73"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ":",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp punctuation.separator.colon.inheritance.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "public",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp storage.type.modifier.access.public.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "base",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp meta.qualified_type.cpp entity.name.type.cpp",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
"light_plus": "entity.name.type: #267F99",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.type: #4EC9B0",
"hc_light": "entity.name.type: #185E73"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "{",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.head.struct.cpp punctuation.section.block.begin.bracket.curly.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "void",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp meta.qualified_type.cpp storage.type.primitive.cpp storage.type.built-in.primitive.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "f",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp meta.head.function.definition.cpp entity.name.function.definition.cpp",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp meta.head.function.definition.cpp punctuation.section.parameters.begin.bracket.round.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp meta.function.definition.cpp meta.head.function.definition.cpp punctuation.section.parameters.end.bracket.round.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ";",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp punctuation.terminator.statement.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "}",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp meta.body.struct.cpp punctuation.section.block.end.bracket.curly.struct.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ";",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.block.struct.cpp punctuation.terminator.statement.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "static",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp storage.modifier.static.cpp",
"r": {
"dark_plus": "storage.modifier: #569CD6",
"light_plus": "storage.modifier: #0000FF",
"dark_vs": "storage.modifier: #569CD6",
"light_vs": "storage.modifier: #0000FF",
"hc_black": "storage.modifier: #569CD6",
"hc_light": "storage.modifier: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "void",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.qualified_type.cpp storage.type.primitive.cpp storage.type.built-in.primitive.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "func",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.head.function.definition.cpp entity.name.function.definition.cpp",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.head.function.definition.cpp punctuation.section.parameters.begin.bracket.round.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.head.function.definition.cpp punctuation.section.parameters.end.bracket.round.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.head.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "{",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.head.function.definition.cpp punctuation.section.block.begin.bracket.curly.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " der v",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ";",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.terminator.statement.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "v",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp variable.other.object.access.cpp",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": ".",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.separator.dot-access.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "f",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp entity.name.function.member.cpp",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.section.arguments.begin.bracket.round.function.member.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.section.arguments.end.bracket.round.function.member.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ";",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.terminator.statement.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "}",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp meta.function.definition.cpp meta.body.function.definition.cpp punctuation.section.block.end.bracket.curly.function.definition.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "DOCTEST_REGISTER_FUNCTION",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp entity.name.function.call.cpp",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp punctuation.section.arguments.begin.bracket.round.function.call.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "DOCTEST_EMPTY",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ",",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp punctuation.separator.delimiter.comma.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " func",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ",",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp punctuation.separator.delimiter.comma.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " decorators",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp punctuation.section.arguments.end.bracket.round.function.call.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "}",
"t": "source.cpp meta.preprocessor.macro.cpp meta.block.namespace.cpp meta.body.namespace.cpp punctuation.section.block.end.bracket.curly.namespace.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "\\",
"t": "source.cpp meta.preprocessor.macro.cpp constant.character.escape.line-continuation.cpp",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #EE0000",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "constant.character: #569CD6",
"hc_light": "constant.character.escape: #EE0000"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "inline",
"t": "source.cpp meta.preprocessor.macro.cpp storage.modifier.specifier.functional.pre-parameters.inline.cpp",
"r": {
"dark_plus": "storage.modifier: #569CD6",
"light_plus": "storage.modifier: #0000FF",
"dark_vs": "storage.modifier: #569CD6",
"light_vs": "storage.modifier: #0000FF",
"hc_black": "storage.modifier: #569CD6",
"hc_light": "storage.modifier: #0F4A85"
}
},
{
"c": " DOCTEST_NOINLINE ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "void",
"t": "source.cpp meta.preprocessor.macro.cpp storage.type.primitive.cpp storage.type.built-in.primitive.cpp",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85"
}
},
{
"c": " ",
"t": "source.cpp meta.preprocessor.macro.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "der",
"t": "source.cpp meta.preprocessor.macro.cpp entity.name.scope-resolution.cpp",
"r": {
"dark_plus": "entity.name.scope-resolution: #4EC9B0",
"light_plus": "entity.name.scope-resolution: #267F99",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.scope-resolution: #4EC9B0",
"hc_light": "entity.name.scope-resolution: #185E73"
}
},
{
"c": "::",
"t": "source.cpp meta.preprocessor.macro.cpp punctuation.separator.namespace.access.cpp punctuation.separator.scope-resolution.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": "f",
"t": "source.cpp meta.preprocessor.macro.cpp entity.name.function.call.cpp",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC"
}
},
{
"c": "(",
"t": "source.cpp meta.preprocessor.macro.cpp punctuation.section.arguments.begin.bracket.round.function.call.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
},
{
"c": ")",
"t": "source.cpp meta.preprocessor.macro.cpp punctuation.section.arguments.end.bracket.round.function.call.cpp",
"r": {
"dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "meta.preprocessor: #0000FF",
"hc_black": "meta.preprocessor: #569CD6",
"hc_light": "meta.preprocessor: #0F4A85"
}
}
] | extensions/vscode-colorize-tests/test/colorize-results/test-78769_cpp.json | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017793251026887447,
0.00017336319433525205,
0.00016833143308758736,
0.00017367259715683758,
0.000002000023414439056
]
|
{
"id": 10,
"code_window": [
"\t\t\t\t}\n",
"\n",
"\t\t\t\tthis._pendingRenames.add({ newUri, oldUri });\n",
"\t\t\t}\n",
"\n",
"\t\t\tif (this._pendingRenames.size) {\n",
"\t\t\t\tthis._delayer.trigger(() => {\n",
"\t\t\t\t\tvscode.window.withProgress({\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t}));\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 52
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as picomatch from 'picomatch';
import * as vscode from 'vscode';
import { TextDocumentEdit } from 'vscode-languageclient';
import * as nls from 'vscode-nls';
import { MdLanguageClient } from '../client/client';
import { Delayer } from '../util/async';
import { noopToken } from '../util/cancellation';
import { Disposable } from '../util/dispose';
import { looksLikeMarkdownPath } from '../util/file';
import { convertRange } from './fileReferences';
const localize = nls.loadMessageBundle();
const settingNames = Object.freeze({
enabled: 'experimental.updateLinksOnFileMove.enabled',
externalFileGlobs: 'experimental.updateLinksOnFileMove.externalFileGlobs',
enableForDirectories: 'experimental.updateLinksOnFileMove.enableForDirectories',
});
const enum UpdateLinksOnFileMoveSetting {
Prompt = 'prompt',
Always = 'always',
Never = 'never',
}
interface RenameAction {
readonly oldUri: vscode.Uri;
readonly newUri: vscode.Uri;
}
class UpdateLinksOnFileRenameHandler extends Disposable {
private readonly _delayer = new Delayer(50);
private readonly _pendingRenames = new Set<RenameAction>();
public constructor(
private readonly client: MdLanguageClient,
) {
super();
this._register(vscode.workspace.onDidRenameFiles(async (e) => {
for (const { newUri, oldUri } of e.files) {
const config = vscode.workspace.getConfiguration('markdown', newUri);
if (!await this.shouldParticipateInLinkUpdate(config, newUri)) {
continue;
}
this._pendingRenames.add({ newUri, oldUri });
}
if (this._pendingRenames.size) {
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: localize('renameProgress.title', "Checking for Markdown links to update")
}, () => this.flushRenames());
});
}
}));
}
private async flushRenames(): Promise<void> {
const renames = Array.from(this._pendingRenames);
this._pendingRenames.clear();
const result = await this.getEditsForFileRename(renames, noopToken);
if (result && result.edit.size) {
if (await this.confirmActionWithUser(result.resourcesBeingRenamed)) {
await vscode.workspace.applyEdit(result.edit);
}
}
}
private async confirmActionWithUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
switch (setting) {
case UpdateLinksOnFileMoveSetting.Prompt:
return this.promptUser(newResources);
case UpdateLinksOnFileMoveSetting.Always:
return true;
case UpdateLinksOnFileMoveSetting.Never:
default:
return false;
}
}
private async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {
const setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);
if (setting === UpdateLinksOnFileMoveSetting.Never) {
return false;
}
if (looksLikeMarkdownPath(newUri)) {
return true;
}
const externalGlob = config.get<string>(settingNames.externalFileGlobs);
if (!!externalGlob && picomatch.isMatch(newUri.fsPath, externalGlob)) {
return true;
}
const stat = await vscode.workspace.fs.stat(newUri);
if (stat.type === vscode.FileType.Directory) {
return config.get<boolean>(settingNames.enableForDirectories, true);
}
return false;
}
private async promptUser(newResources: readonly vscode.Uri[]): Promise<boolean> {
if (!newResources.length) {
return false;
}
const rejectItem: vscode.MessageItem = {
title: localize('reject.title', "No"),
isCloseAffordance: true,
};
const acceptItem: vscode.MessageItem = {
title: localize('accept.title', "Yes"),
};
const alwaysItem: vscode.MessageItem = {
title: localize('always.title', "Always automatically update Markdown Links"),
};
const neverItem: vscode.MessageItem = {
title: localize('never.title', "Never automatically update Markdown Links"),
};
const choice = await vscode.window.showInformationMessage(
newResources.length === 1
? localize('prompt', "Update Markdown links for '{0}'?", path.basename(newResources[0].fsPath))
: this.getConfirmMessage(localize('promptMoreThanOne', "Update Markdown link for the following {0} files?", newResources.length), newResources), {
modal: true,
}, rejectItem, acceptItem, alwaysItem, neverItem);
switch (choice) {
case acceptItem: {
return true;
}
case rejectItem: {
return false;
}
case alwaysItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Always,
this.getConfigTargetScope(config, settingNames.enabled));
return true;
}
case neverItem: {
const config = vscode.workspace.getConfiguration('markdown', newResources[0]);
config.update(
settingNames.enabled,
UpdateLinksOnFileMoveSetting.Never,
this.getConfigTargetScope(config, settingNames.enabled));
return false;
}
default: {
return false;
}
}
}
private async getEditsForFileRename(renames: readonly RenameAction[], token: vscode.CancellationToken): Promise<{ edit: vscode.WorkspaceEdit; resourcesBeingRenamed: vscode.Uri[] } | undefined> {
const result = await this.client.getEditForFileRenames(renames.map(rename => ({ oldUri: rename.oldUri.toString(), newUri: rename.newUri.toString() })), token);
if (!result?.edit.documentChanges?.length) {
return undefined;
}
const workspaceEdit = new vscode.WorkspaceEdit();
for (const change of result.edit.documentChanges as TextDocumentEdit[]) {
const uri = vscode.Uri.parse(change.textDocument.uri);
for (const edit of change.edits) {
workspaceEdit.replace(uri, convertRange(edit.range), edit.newText);
}
}
return {
edit: workspaceEdit,
resourcesBeingRenamed: result.participatingRenames.map(x => vscode.Uri.parse(x.newUri)),
};
}
private getConfirmMessage(start: string, resourcesToConfirm: readonly vscode.Uri[]): string {
const MAX_CONFIRM_FILES = 10;
const paths = [start];
paths.push('');
paths.push(...resourcesToConfirm.slice(0, MAX_CONFIRM_FILES).map(r => path.basename(r.fsPath)));
if (resourcesToConfirm.length > MAX_CONFIRM_FILES) {
if (resourcesToConfirm.length - MAX_CONFIRM_FILES === 1) {
paths.push(localize('moreFile', "...1 additional file not shown"));
} else {
paths.push(localize('moreFiles', "...{0} additional files not shown", resourcesToConfirm.length - MAX_CONFIRM_FILES));
}
}
paths.push('');
return paths.join('\n');
}
private getConfigTargetScope(config: vscode.WorkspaceConfiguration, settingsName: string): vscode.ConfigurationTarget {
const inspected = config.inspect(settingsName);
if (inspected?.workspaceFolderValue) {
return vscode.ConfigurationTarget.WorkspaceFolder;
}
if (inspected?.workspaceValue) {
return vscode.ConfigurationTarget.Workspace;
}
return vscode.ConfigurationTarget.Global;
}
}
export function registerUpdateLinksOnRename(client: MdLanguageClient) {
return new UpdateLinksOnFileRenameHandler(client);
}
| extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.9917815327644348,
0.043801382184028625,
0.00016628547746222466,
0.00022764487948734313,
0.19787916541099548
]
|
{
"id": 10,
"code_window": [
"\t\t\t\t}\n",
"\n",
"\t\t\t\tthis._pendingRenames.add({ newUri, oldUri });\n",
"\t\t\t}\n",
"\n",
"\t\t\tif (this._pendingRenames.size) {\n",
"\t\t\t\tthis._delayer.trigger(() => {\n",
"\t\t\t\t\tvscode.window.withProgress({\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t}));\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 52
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken } from 'vs/base/common/cancellation';
import { onUnexpectedExternalError } from 'vs/base/common/errors';
import { URI } from 'vs/base/common/uri';
import { ITextModel } from 'vs/editor/common/model';
import { DocumentSemanticTokensProvider, SemanticTokens, SemanticTokensEdits, SemanticTokensLegend, DocumentRangeSemanticTokensProvider } from 'vs/editor/common/languages';
import { IModelService } from 'vs/editor/common/services/model';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { assertType } from 'vs/base/common/types';
import { VSBuffer } from 'vs/base/common/buffer';
import { encodeSemanticTokensDto } from 'vs/editor/common/services/semanticTokensDto';
import { Range } from 'vs/editor/common/core/range';
import { LanguageFeatureRegistry } from 'vs/editor/common/languageFeatureRegistry';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
export function isSemanticTokens(v: SemanticTokens | SemanticTokensEdits): v is SemanticTokens {
return v && !!((<SemanticTokens>v).data);
}
export function isSemanticTokensEdits(v: SemanticTokens | SemanticTokensEdits): v is SemanticTokensEdits {
return v && Array.isArray((<SemanticTokensEdits>v).edits);
}
export class DocumentSemanticTokensResult {
constructor(
public readonly provider: DocumentSemanticTokensProvider,
public readonly tokens: SemanticTokens | SemanticTokensEdits | null,
public readonly error: any
) { }
}
export function hasDocumentSemanticTokensProvider(registry: LanguageFeatureRegistry<DocumentSemanticTokensProvider>, model: ITextModel): boolean {
return registry.has(model);
}
function getDocumentSemanticTokensProviders(registry: LanguageFeatureRegistry<DocumentSemanticTokensProvider>, model: ITextModel): DocumentSemanticTokensProvider[] {
const groups = registry.orderedGroups(model);
return (groups.length > 0 ? groups[0] : []);
}
export async function getDocumentSemanticTokens(registry: LanguageFeatureRegistry<DocumentSemanticTokensProvider>, model: ITextModel, lastProvider: DocumentSemanticTokensProvider | null, lastResultId: string | null, token: CancellationToken): Promise<DocumentSemanticTokensResult | null> {
const providers = getDocumentSemanticTokensProviders(registry, model);
// Get tokens from all providers at the same time.
const results = await Promise.all(providers.map(async (provider) => {
let result: SemanticTokens | SemanticTokensEdits | null | undefined;
let error: any = null;
try {
result = await provider.provideDocumentSemanticTokens(model, (provider === lastProvider ? lastResultId : null), token);
} catch (err) {
error = err;
result = null;
}
if (!result || (!isSemanticTokens(result) && !isSemanticTokensEdits(result))) {
result = null;
}
return new DocumentSemanticTokensResult(provider, result, error);
}));
// Try to return the first result with actual tokens or
// the first result which threw an error (!!)
for (const result of results) {
if (result.error) {
throw result.error;
}
if (result.tokens) {
return result;
}
}
// Return the first result, even if it doesn't have tokens
if (results.length > 0) {
return results[0];
}
return null;
}
function _getDocumentSemanticTokensProviderHighestGroup(registry: LanguageFeatureRegistry<DocumentSemanticTokensProvider>, model: ITextModel): DocumentSemanticTokensProvider[] | null {
const result = registry.orderedGroups(model);
return (result.length > 0 ? result[0] : null);
}
class DocumentRangeSemanticTokensResult {
constructor(
public readonly provider: DocumentRangeSemanticTokensProvider,
public readonly tokens: SemanticTokens | null,
) { }
}
export function hasDocumentRangeSemanticTokensProvider(providers: LanguageFeatureRegistry<DocumentRangeSemanticTokensProvider>, model: ITextModel): boolean {
return providers.has(model);
}
function getDocumentRangeSemanticTokensProviders(providers: LanguageFeatureRegistry<DocumentRangeSemanticTokensProvider>, model: ITextModel): DocumentRangeSemanticTokensProvider[] {
const groups = providers.orderedGroups(model);
return (groups.length > 0 ? groups[0] : []);
}
export async function getDocumentRangeSemanticTokens(registry: LanguageFeatureRegistry<DocumentRangeSemanticTokensProvider>, model: ITextModel, range: Range, token: CancellationToken): Promise<DocumentRangeSemanticTokensResult | null> {
const providers = getDocumentRangeSemanticTokensProviders(registry, model);
// Get tokens from all providers at the same time.
const results = await Promise.all(providers.map(async (provider) => {
let result: SemanticTokens | null | undefined;
try {
result = await provider.provideDocumentRangeSemanticTokens(model, range, token);
} catch (err) {
onUnexpectedExternalError(err);
result = null;
}
if (!result || !isSemanticTokens(result)) {
result = null;
}
return new DocumentRangeSemanticTokensResult(provider, result);
}));
// Try to return the first result with actual tokens
for (const result of results) {
if (result.tokens) {
return result;
}
}
// Return the first result, even if it doesn't have tokens
if (results.length > 0) {
return results[0];
}
return null;
}
CommandsRegistry.registerCommand('_provideDocumentSemanticTokensLegend', async (accessor, ...args): Promise<SemanticTokensLegend | undefined> => {
const [uri] = args;
assertType(uri instanceof URI);
const model = accessor.get(IModelService).getModel(uri);
if (!model) {
return undefined;
}
const { documentSemanticTokensProvider } = accessor.get(ILanguageFeaturesService);
const providers = _getDocumentSemanticTokensProviderHighestGroup(documentSemanticTokensProvider, model);
if (!providers) {
// there is no provider => fall back to a document range semantic tokens provider
return accessor.get(ICommandService).executeCommand('_provideDocumentRangeSemanticTokensLegend', uri);
}
return providers[0].getLegend();
});
CommandsRegistry.registerCommand('_provideDocumentSemanticTokens', async (accessor, ...args): Promise<VSBuffer | undefined> => {
const [uri] = args;
assertType(uri instanceof URI);
const model = accessor.get(IModelService).getModel(uri);
if (!model) {
return undefined;
}
const { documentSemanticTokensProvider } = accessor.get(ILanguageFeaturesService);
if (!hasDocumentSemanticTokensProvider(documentSemanticTokensProvider, model)) {
// there is no provider => fall back to a document range semantic tokens provider
return accessor.get(ICommandService).executeCommand('_provideDocumentRangeSemanticTokens', uri, model.getFullModelRange());
}
const r = await getDocumentSemanticTokens(documentSemanticTokensProvider, model, null, null, CancellationToken.None);
if (!r) {
return undefined;
}
const { provider, tokens } = r;
if (!tokens || !isSemanticTokens(tokens)) {
return undefined;
}
const buff = encodeSemanticTokensDto({
id: 0,
type: 'full',
data: tokens.data
});
if (tokens.resultId) {
provider.releaseDocumentSemanticTokens(tokens.resultId);
}
return buff;
});
CommandsRegistry.registerCommand('_provideDocumentRangeSemanticTokensLegend', async (accessor, ...args): Promise<SemanticTokensLegend | undefined> => {
const [uri, range] = args;
assertType(uri instanceof URI);
const model = accessor.get(IModelService).getModel(uri);
if (!model) {
return undefined;
}
const { documentRangeSemanticTokensProvider } = accessor.get(ILanguageFeaturesService);
const providers = getDocumentRangeSemanticTokensProviders(documentRangeSemanticTokensProvider, model);
if (providers.length === 0) {
// no providers
return undefined;
}
if (providers.length === 1) {
// straight forward case, just a single provider
return providers[0].getLegend();
}
if (!range || !Range.isIRange(range)) {
// if no range is provided, we cannot support multiple providers
// as we cannot fall back to the one which would give results
// => return the first legend for backwards compatibility and print a warning
console.warn(`provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in`);
return providers[0].getLegend();
}
const result = await getDocumentRangeSemanticTokens(documentRangeSemanticTokensProvider, model, Range.lift(range), CancellationToken.None);
if (!result) {
return undefined;
}
return result.provider.getLegend();
});
CommandsRegistry.registerCommand('_provideDocumentRangeSemanticTokens', async (accessor, ...args): Promise<VSBuffer | undefined> => {
const [uri, range] = args;
assertType(uri instanceof URI);
assertType(Range.isIRange(range));
const model = accessor.get(IModelService).getModel(uri);
if (!model) {
return undefined;
}
const { documentRangeSemanticTokensProvider } = accessor.get(ILanguageFeaturesService);
const result = await getDocumentRangeSemanticTokens(documentRangeSemanticTokensProvider, model, Range.lift(range), CancellationToken.None);
if (!result || !result.tokens) {
// there is no provider or it didn't return tokens
return undefined;
}
return encodeSemanticTokensDto({
id: 0,
type: 'full',
data: result.tokens.data
});
});
| src/vs/editor/common/services/getSemanticTokens.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0002321503561688587,
0.00017476797802373767,
0.00016706374299246818,
0.000173048087162897,
0.000011812696357083041
]
|
{
"id": 10,
"code_window": [
"\t\t\t\t}\n",
"\n",
"\t\t\t\tthis._pendingRenames.add({ newUri, oldUri });\n",
"\t\t\t}\n",
"\n",
"\t\t\tif (this._pendingRenames.size) {\n",
"\t\t\t\tthis._delayer.trigger(() => {\n",
"\t\t\t\t\tvscode.window.withProgress({\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t}));\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 52
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
export class StaticServiceAccessor implements ServicesAccessor {
private services = new Map<ServiceIdentifier<any>, any>();
public withService<T>(id: ServiceIdentifier<T>, service: T): this {
this.services.set(id, service);
return this;
}
public get<T>(id: ServiceIdentifier<T>): T {
const value = this.services.get(id);
if (!value) {
throw new Error('Service does not exist');
}
return value;
}
}
| src/vs/editor/contrib/wordPartOperations/test/browser/utils.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017766549717634916,
0.00017504836432635784,
0.00017168658087030053,
0.00017579301493242383,
0.0000024970299818960484
]
|
{
"id": 10,
"code_window": [
"\t\t\t\t}\n",
"\n",
"\t\t\t\tthis._pendingRenames.add({ newUri, oldUri });\n",
"\t\t\t}\n",
"\n",
"\t\t\tif (this._pendingRenames.size) {\n",
"\t\t\t\tthis._delayer.trigger(() => {\n",
"\t\t\t\t\tvscode.window.withProgress({\n"
],
"labels": [
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t}));\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 52
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout({
layout: { id: 'com.apple.keylayout.British', lang: 'en', localizedName: 'British' },
secondaryLayouts: [],
mapping: {
KeyA: ['a', 'A', 'å', 'Å', 0],
KeyB: ['b', 'B', '∫', 'ı', 0],
KeyC: ['c', 'C', 'ç', 'Ç', 0],
KeyD: ['d', 'D', '∂', 'Î', 0],
KeyE: ['e', 'E', '´', '‰', 4],
KeyF: ['f', 'F', 'ƒ', 'Ï', 0],
KeyG: ['g', 'G', '©', 'Ì', 0],
KeyH: ['h', 'H', '˙', 'Ó', 0],
KeyI: ['i', 'I', '^', 'È', 4],
KeyJ: ['j', 'J', '∆', 'Ô', 0],
KeyK: ['k', 'K', '˚', '', 0],
KeyL: ['l', 'L', '¬', 'Ò', 0],
KeyM: ['m', 'M', 'µ', '˜', 0],
KeyN: ['n', 'N', '~', 'ˆ', 4],
KeyO: ['o', 'O', 'ø', 'Ø', 0],
KeyP: ['p', 'P', 'π', '∏', 0],
KeyQ: ['q', 'Q', 'œ', 'Œ', 0],
KeyR: ['r', 'R', '®', 'Â', 0],
KeyS: ['s', 'S', 'ß', 'Í', 0],
KeyT: ['t', 'T', '†', 'Ê', 0],
KeyU: ['u', 'U', '¨', 'Ë', 4],
KeyV: ['v', 'V', '√', '◊', 0],
KeyW: ['w', 'W', '∑', '„', 0],
KeyX: ['x', 'X', '≈', 'Ù', 0],
KeyY: ['y', 'Y', '¥', 'Á', 0],
KeyZ: ['z', 'Z', 'Ω', 'Û', 0],
Digit1: ['1', '!', '¡', '⁄', 0],
Digit2: ['2', '@', '€', '™', 0],
Digit3: ['3', '£', '#', '‹', 0],
Digit4: ['4', '$', '¢', '›', 0],
Digit5: ['5', '%', '∞', 'fi', 0],
Digit6: ['6', '^', '§', 'fl', 0],
Digit7: ['7', '&', '¶', '‡', 0],
Digit8: ['8', '*', '•', '°', 0],
Digit9: ['9', '(', 'ª', '·', 0],
Digit0: ['0', ')', 'º', '‚', 0],
Enter: [],
Escape: [],
Backspace: [],
Tab: [],
Space: [' ', ' ', ' ', ' ', 0],
Minus: ['-', '_', '–', '—', 0],
Equal: ['=', '+', '≠', '±', 0],
BracketLeft: ['[', '{', '“', '”', 0],
BracketRight: [']', '}', '‘', '’', 0],
Backslash: ['\\', '|', '«', '»', 0],
Semicolon: [';', ':', '…', 'Ú', 0],
Quote: ['\'', '"', 'æ', 'Æ', 0],
Backquote: ['`', '~', '`', 'Ÿ', 4],
Comma: [',', '<', '≤', '¯', 0],
Period: ['.', '>', '≥', '˘', 0],
Slash: ['/', '?', '÷', '¿', 0],
CapsLock: [],
F1: [],
F2: [],
F3: [],
F4: [],
F5: [],
F6: [],
F7: [],
F8: [],
F9: [],
F10: [],
F11: [],
F12: [],
Insert: [],
Home: [],
PageUp: [],
Delete: [],
End: [],
PageDown: [],
ArrowRight: [],
ArrowLeft: [],
ArrowDown: [],
ArrowUp: [],
NumLock: [],
NumpadDivide: ['/', '/', '/', '/', 0],
NumpadMultiply: ['*', '*', '*', '*', 0],
NumpadSubtract: ['-', '-', '-', '-', 0],
NumpadAdd: ['+', '+', '+', '+', 0],
NumpadEnter: [],
Numpad1: ['1', '1', '1', '1', 0],
Numpad2: ['2', '2', '2', '2', 0],
Numpad3: ['3', '3', '3', '3', 0],
Numpad4: ['4', '4', '4', '4', 0],
Numpad5: ['5', '5', '5', '5', 0],
Numpad6: ['6', '6', '6', '6', 0],
Numpad7: ['7', '7', '7', '7', 0],
Numpad8: ['8', '8', '8', '8', 0],
Numpad9: ['9', '9', '9', '9', 0],
Numpad0: ['0', '0', '0', '0', 0],
NumpadDecimal: ['.', '.', '.', '.', 0],
IntlBackslash: ['§', '±', '', '', 0],
ContextMenu: [],
NumpadEqual: ['=', '=', '=', '=', 0],
F13: [],
F14: [],
F15: [],
F16: [],
F17: [],
F18: [],
F19: [],
F20: [],
AudioVolumeMute: [],
AudioVolumeUp: ['', '=', '', '=', 0],
AudioVolumeDown: [],
NumpadComma: [],
IntlRo: [],
KanaMode: [],
IntlYen: [],
ControlLeft: [],
ShiftLeft: [],
AltLeft: [],
MetaLeft: [],
ControlRight: [],
ShiftRight: [],
AltRight: [],
MetaRight: []
}
}); | src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017800446948967874,
0.00017249598749913275,
0.00016764171596150845,
0.00017252162797376513,
0.000003146582002955256
]
|
{
"id": 11,
"code_window": [
"\t\t\tdefault:\n",
"\t\t\t\treturn false;\n",
"\t\t}\n",
"\t}\n",
"\tprivate async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);\n",
"\t\tif (setting === UpdateLinksOnFileMoveSetting.Never) {\n",
"\t\t\treturn false;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tprivate async shouldParticipateInLinkUpdate(newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 97
} | {
"name": "markdown-language-features",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"vscode": "^1.70.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown.preview.toggleLock",
"onCommand:markdown.preview.refresh",
"onCommand:markdown.showPreview",
"onCommand:markdown.showPreviewToSide",
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onCommand:markdown.api.reloadPlugins",
"onCommand:markdown.findAllFileReferences",
"onWebviewPanel:markdown.preview",
"onCustomEditor:vscode.markdown.preview.editor"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": "limited",
"description": "%workspaceTrust%",
"restrictedConfigurations": [
"markdown.styles"
]
}
},
"contributes": {
"notebookRenderer": [
{
"id": "vscode.markdown-it-renderer",
"displayName": "Markdown it renderer",
"entrypoint": "./notebook-out/index.js",
"mimeTypes": [
"text/markdown",
"text/latex",
"text/x-css",
"text/x-html",
"text/x-json",
"text/x-typescript",
"text/x-abap",
"text/x-apex",
"text/x-azcli",
"text/x-bat",
"text/x-cameligo",
"text/x-clojure",
"text/x-coffee",
"text/x-cpp",
"text/x-csharp",
"text/x-csp",
"text/x-css",
"text/x-dart",
"text/x-dockerfile",
"text/x-ecl",
"text/x-fsharp",
"text/x-go",
"text/x-graphql",
"text/x-handlebars",
"text/x-hcl",
"text/x-html",
"text/x-ini",
"text/x-java",
"text/x-javascript",
"text/x-julia",
"text/x-kotlin",
"text/x-less",
"text/x-lexon",
"text/x-lua",
"text/x-m3",
"text/x-markdown",
"text/x-mips",
"text/x-msdax",
"text/x-mysql",
"text/x-objective-c/objective",
"text/x-pascal",
"text/x-pascaligo",
"text/x-perl",
"text/x-pgsql",
"text/x-php",
"text/x-postiats",
"text/x-powerquery",
"text/x-powershell",
"text/x-pug",
"text/x-python",
"text/x-r",
"text/x-razor",
"text/x-redis",
"text/x-redshift",
"text/x-restructuredtext",
"text/x-ruby",
"text/x-rust",
"text/x-sb",
"text/x-scala",
"text/x-scheme",
"text/x-scss",
"text/x-shell",
"text/x-solidity",
"text/x-sophia",
"text/x-sql",
"text/x-st",
"text/x-swift",
"text/x-systemverilog",
"text/x-tcl",
"text/x-twig",
"text/x-typescript",
"text/x-vb",
"text/x-xml",
"text/x-yaml",
"application/json"
]
}
],
"commands": [
{
"command": "markdown.showPreview",
"title": "%markdown.preview.title%",
"category": "Markdown",
"icon": {
"light": "./media/preview-light.svg",
"dark": "./media/preview-dark.svg"
}
},
{
"command": "markdown.showPreviewToSide",
"title": "%markdown.previewSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showLockedPreviewToSide",
"title": "%markdown.showLockedPreviewToSide.title%",
"category": "Markdown",
"icon": "$(open-preview)"
},
{
"command": "markdown.showSource",
"title": "%markdown.showSource.title%",
"category": "Markdown",
"icon": "$(go-to-file)"
},
{
"command": "markdown.showPreviewSecuritySelector",
"title": "%markdown.showPreviewSecuritySelector.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.refresh",
"title": "%markdown.preview.refresh.title%",
"category": "Markdown"
},
{
"command": "markdown.preview.toggleLock",
"title": "%markdown.preview.toggleLock.title%",
"category": "Markdown"
},
{
"command": "markdown.findAllFileReferences",
"title": "%markdown.findAllFileReferences%",
"category": "Markdown"
}
],
"menus": {
"editor/title": [
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "1_markdown"
}
],
"explorer/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "markdown.showPreview",
"when": "resourceLangId == markdown && !hasCustomMarkdownPreview",
"group": "1_open"
},
{
"command": "markdown.findAllFileReferences",
"when": "resourceLangId == markdown"
}
],
"commandPalette": [
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showLockedPreviewToSide",
"when": "editorLangId == markdown && !notebookEditorFocused",
"group": "navigation"
},
{
"command": "markdown.showSource",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewSecuritySelector",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.toggleLock",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.preview.refresh",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.preview.refresh",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
},
{
"command": "markdown.findAllFileReferences",
"when": "editorLangId == markdown"
}
]
},
"keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "editorLangId == markdown && !notebookEditorFocused"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == markdown && !notebookEditorFocused"
}
],
"configuration": {
"type": "object",
"title": "Markdown",
"order": 20,
"properties": {
"markdown.styles": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "%markdown.styles.dec%",
"scope": "resource"
},
"markdown.preview.breaks": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.breaks.desc%",
"scope": "resource"
},
"markdown.preview.linkify": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
"description": "%markdown.preview.fontFamily.desc%",
"scope": "resource"
},
"markdown.preview.fontSize": {
"type": "number",
"default": 14,
"description": "%markdown.preview.fontSize.desc%",
"scope": "resource"
},
"markdown.preview.lineHeight": {
"type": "number",
"default": 1.6,
"description": "%markdown.preview.lineHeight.desc%",
"scope": "resource"
},
"markdown.preview.scrollPreviewWithEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollPreviewWithEditor.desc%",
"scope": "resource"
},
"markdown.preview.markEditorSelection": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.markEditorSelection.desc%",
"scope": "resource"
},
"markdown.preview.scrollEditorWithPreview": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.scrollEditorWithPreview.desc%",
"scope": "resource"
},
"markdown.preview.doubleClickToSwitchToEditor": {
"type": "boolean",
"default": true,
"description": "%markdown.preview.doubleClickToSwitchToEditor.desc%",
"scope": "resource"
},
"markdown.preview.openMarkdownLinks": {
"type": "string",
"default": "inPreview",
"description": "%configuration.markdown.preview.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"inPreview",
"inEditor"
],
"enumDescriptions": [
"%configuration.markdown.preview.openMarkdownLinks.inPreview%",
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.links.openLocation": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.links.openLocation.description%",
"scope": "resource",
"enum": [
"currentGroup",
"beside"
],
"enumDescriptions": [
"%configuration.markdown.links.openLocation.currentGroup%",
"%configuration.markdown.links.openLocation.beside%"
]
},
"markdown.suggest.paths.enabled": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.suggest.paths.enabled.description%",
"scope": "resource"
},
"markdown.trace.extension": {
"type": "string",
"enum": [
"off",
"verbose"
],
"default": "off",
"description": "%markdown.trace.extension.desc%",
"scope": "window"
},
"markdown.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "%markdown.trace.server.desc%"
},
"markdown.editor.drop.enabled": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.markdown.editor.drop.enabled%",
"scope": "resource"
},
"markdown.experimental.editor.pasteLinks.enabled": {
"type": "boolean",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteLinks.enabled%",
"default": true,
"tags": [
"experimental"
]
},
"markdown.validate.enabled": {
"type": "boolean",
"scope": "resource",
"description": "%configuration.markdown.validate.enabled.description%",
"default": false
},
"markdown.validate.referenceLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.referenceLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fragmentLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fragmentLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.enabled.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.validate.fileLinks.markdownFragmentLinks": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",
"default": "inherit",
"enum": [
"inherit",
"ignore",
"warning",
"error"
]
},
"markdown.validate.ignoredLinks": {
"type": "array",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.ignoredLinks.description%",
"items": {
"type": "string"
}
},
"markdown.validate.unusedLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.unusedLinkDefinitions.description%",
"default": "hint",
"enum": [
"ignore",
"hint",
"warning",
"error"
]
},
"markdown.validate.duplicateLinkDefinitions.enabled": {
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.validate.duplicateLinkDefinitions.description%",
"default": "warning",
"enum": [
"ignore",
"warning",
"error"
]
},
"markdown.experimental.updateLinksOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"markdownEnumDescriptions": [
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.always%",
"%configuration.markdown.experimental.updateLinksOnFileMove.enabled.never%"
],
"default": "never",
"markdownDescription": "%configuration.markdown.experimental.updateLinksOnFileMove.enabled%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.externalFileGlobs": {
"type": "string",
"default": "**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}",
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs%",
"scope": "resource",
"tags": [
"experimental"
]
},
"markdown.experimental.updateLinksOnFileMove.enableForDirectories": {
"type": "boolean",
"default": true,
"description": "%configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories%",
"scope": "resource",
"tags": [
"experimental"
]
}
}
},
"configurationDefaults": {
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
}
},
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"
],
"customEditors": [
{
"viewType": "vscode.markdown.preview.editor",
"displayName": "Markdown Preview",
"priority": "option",
"selector": [
{
"filenamePattern": "*.md"
}
]
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features-languageService && gulp compile-extension:markdown-language-features-server && gulp compile-extension:markdown-language-features && npm run build-preview && npm run build-notebook",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features watch-extension:markdown-language-features-languageService watch-extension:markdown-language-features-server",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-notebook": "node ./esbuild-notebook",
"build-preview": "node ./esbuild-preview",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"dompurify": "^2.3.3",
"highlight.js": "^11.4.0",
"markdown-it": "^12.3.2",
"markdown-it-front-matter": "^0.2.1",
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
"@types/dompurify": "^2.3.1",
"@types/lodash.throttle": "^4.1.3",
"@types/markdown-it": "12.2.3",
"@types/picomatch": "^2.3.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@types/vscode-webview": "^1.57.0",
"lodash.throttle": "^4.1.1",
"vscode-languageserver-types": "^3.17.2",
"vscode-markdown-languageservice": "^0.0.0-alpha.10"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
| extensions/markdown-language-features/package.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0011592336231842637,
0.00020073255291208625,
0.0001645634911255911,
0.00017153078806586564,
0.0001508962595835328
]
|
{
"id": 11,
"code_window": [
"\t\t\tdefault:\n",
"\t\t\t\treturn false;\n",
"\t\t}\n",
"\t}\n",
"\tprivate async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);\n",
"\t\tif (setting === UpdateLinksOnFileMoveSetting.Never) {\n",
"\t\t\treturn false;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tprivate async shouldParticipateInLinkUpdate(newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 97
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { splitLines } from 'vs/base/common/strings';
import { Position } from 'vs/editor/common/core/position';
import { IRange, Range } from 'vs/editor/common/core/range';
import { BeforeEditPositionMapper, TextEditInfo } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper';
import { Length, lengthOfString, lengthToObj, lengthToPosition, toLength } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length';
suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
test('Single-Line 1', () => {
assert.deepStrictEqual(
compute(
[
'0123456789',
],
[
new TextEdit(toLength(0, 4), toLength(0, 7), 'xy')
]
),
[
'0 1 2 3 x y 7 8 9 ', // The line
'0 0 0 0 0 0 0 0 0 0 ', // the old line numbers
'0 1 2 3 4 5 7 8 9 10 ', // the old columns
'0 0 0 0 0 0 0 0 0 0 ', // line count until next change
'4 3 2 1 0 0 3 2 1 0 ', // column count until next change
]
);
});
test('Single-Line 2', () => {
assert.deepStrictEqual(
compute(
[
'0123456789',
],
[
new TextEdit(toLength(0, 2), toLength(0, 4), 'xxxx'),
new TextEdit(toLength(0, 6), toLength(0, 6), 'yy')
]
),
[
'0 1 x x x x 4 5 y y 6 7 8 9 ',
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
'0 1 2 3 4 5 4 5 6 7 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
'2 1 0 0 0 0 2 1 0 0 4 3 2 1 0 ',
]
);
});
test('Multi-Line Replace 1', () => {
assert.deepStrictEqual(
compute(
[
'₀₁₂₃₄₅₆₇₈₉',
'0123456789',
'⁰¹²³⁴⁵⁶⁷⁸⁹',
],
[
new TextEdit(toLength(0, 3), toLength(1, 3), 'xy'),
]
),
[
'₀ ₁ ₂ x y 3 4 5 6 7 8 9 ',
'0 0 0 0 0 1 1 1 1 1 1 1 1 ',
'0 1 2 3 4 3 4 5 6 7 8 9 10 ',
'0 0 0 0 0 1 1 1 1 1 1 1 1 ',
'3 2 1 0 0 10 10 10 10 10 10 10 10 ',
// ------------------
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
'2 2 2 2 2 2 2 2 2 2 2 ',
'0 1 2 3 4 5 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 0 0 0 ',
'10 9 8 7 6 5 4 3 2 1 0 ',
]
);
});
test('Multi-Line Replace 2', () => {
assert.deepStrictEqual(
compute(
[
'₀₁₂₃₄₅₆₇₈₉',
'012345678',
'⁰¹²³⁴⁵⁶⁷⁸⁹',
],
[
new TextEdit(toLength(0, 3), toLength(1, 0), 'ab'),
new TextEdit(toLength(1, 5), toLength(1, 7), 'c'),
]
),
[
'₀ ₁ ₂ a b 0 1 2 3 4 c 7 8 ',
'0 0 0 0 0 1 1 1 1 1 1 1 1 1 ',
'0 1 2 3 4 0 1 2 3 4 5 7 8 9 ',
'0 0 0 0 0 0 0 0 0 0 0 1 1 1 ',
'3 2 1 0 0 5 4 3 2 1 0 10 10 10 ',
// ------------------
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
'2 2 2 2 2 2 2 2 2 2 2 ',
'0 1 2 3 4 5 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 0 0 0 ',
'10 9 8 7 6 5 4 3 2 1 0 ',
]
);
});
test('Multi-Line Replace 3', () => {
assert.deepStrictEqual(
compute(
[
'₀₁₂₃₄₅₆₇₈₉',
'012345678',
'⁰¹²³⁴⁵⁶⁷⁸⁹',
],
[
new TextEdit(toLength(0, 3), toLength(1, 0), 'ab'),
new TextEdit(toLength(1, 5), toLength(1, 7), 'c'),
new TextEdit(toLength(1, 8), toLength(2, 4), 'd'),
]
),
[
'₀ ₁ ₂ a b 0 1 2 3 4 c 7 d ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
'0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 ',
'0 1 2 3 4 0 1 2 3 4 5 7 8 4 5 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
'3 2 1 0 0 5 4 3 2 1 0 1 0 6 5 4 3 2 1 0 ',
]
);
});
test('Multi-Line Insert 1', () => {
assert.deepStrictEqual(
compute(
[
'012345678',
],
[
new TextEdit(toLength(0, 3), toLength(0, 5), 'a\nb'),
]
),
[
'0 1 2 a ',
'0 0 0 0 0 ',
'0 1 2 3 4 ',
'0 0 0 0 0 ',
'3 2 1 0 0 ',
// ------------------
'b 5 6 7 8 ',
'1 0 0 0 0 0 ',
'0 5 6 7 8 9 ',
'0 0 0 0 0 0 ',
'0 4 3 2 1 0 ',
]
);
});
test('Multi-Line Insert 2', () => {
assert.deepStrictEqual(
compute(
[
'012345678',
],
[
new TextEdit(toLength(0, 3), toLength(0, 5), 'a\nb'),
new TextEdit(toLength(0, 7), toLength(0, 8), 'x\ny'),
]
),
[
'0 1 2 a ',
'0 0 0 0 0 ',
'0 1 2 3 4 ',
'0 0 0 0 0 ',
'3 2 1 0 0 ',
// ------------------
'b 5 6 x ',
'1 0 0 0 0 ',
'0 5 6 7 8 ',
'0 0 0 0 0 ',
'0 2 1 0 0 ',
// ------------------
'y 8 ',
'1 0 0 ',
'0 8 9 ',
'0 0 0 ',
'0 1 0 ',
]
);
});
test('Multi-Line Replace/Insert 1', () => {
assert.deepStrictEqual(
compute(
[
'₀₁₂₃₄₅₆₇₈₉',
'012345678',
'⁰¹²³⁴⁵⁶⁷⁸⁹',
],
[
new TextEdit(toLength(0, 3), toLength(1, 1), 'aaa\nbbb'),
]
),
[
'₀ ₁ ₂ a a a ',
'0 0 0 0 0 0 0 ',
'0 1 2 3 4 5 6 ',
'0 0 0 0 0 0 0 ',
'3 2 1 0 0 0 0 ',
// ------------------
'b b b 1 2 3 4 5 6 7 8 ',
'1 1 1 1 1 1 1 1 1 1 1 1 ',
'0 1 2 1 2 3 4 5 6 7 8 9 ',
'0 0 0 1 1 1 1 1 1 1 1 1 ',
'0 0 0 10 10 10 10 10 10 10 10 10 ',
// ------------------
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
'2 2 2 2 2 2 2 2 2 2 2 ',
'0 1 2 3 4 5 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 0 0 0 ',
'10 9 8 7 6 5 4 3 2 1 0 ',
]
);
});
test('Multi-Line Replace/Insert 2', () => {
assert.deepStrictEqual(
compute(
[
'₀₁₂₃₄₅₆₇₈₉',
'012345678',
'⁰¹²³⁴⁵⁶⁷⁸⁹',
],
[
new TextEdit(toLength(0, 3), toLength(1, 1), 'aaa\nbbb'),
new TextEdit(toLength(1, 5), toLength(1, 5), 'x\ny'),
new TextEdit(toLength(1, 7), toLength(2, 4), 'k\nl'),
]
),
[
'₀ ₁ ₂ a a a ',
'0 0 0 0 0 0 0 ',
'0 1 2 3 4 5 6 ',
'0 0 0 0 0 0 0 ',
'3 2 1 0 0 0 0 ',
// ------------------
'b b b 1 2 3 4 x ',
'1 1 1 1 1 1 1 1 1 ',
'0 1 2 1 2 3 4 5 6 ',
'0 0 0 0 0 0 0 0 0 ',
'0 0 0 4 3 2 1 0 0 ',
// ------------------
'y 5 6 k ',
'2 1 1 1 1 ',
'0 5 6 7 8 ',
'0 0 0 0 0 ',
'0 2 1 0 0 ',
// ------------------
'l ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
'2 2 2 2 2 2 2 2 ',
'0 4 5 6 7 8 9 10 ',
'0 0 0 0 0 0 0 0 ',
'0 6 5 4 3 2 1 0 ',
]
);
});
});
/** @pure */
function compute(inputArr: string[], edits: TextEdit[]): string[] {
const newLines = splitLines(applyLineColumnEdits(inputArr.join('\n'), edits.map(e => ({
text: e.newText,
range: Range.fromPositions(lengthToPosition(e.startOffset), lengthToPosition(e.endOffset))
}))));
const mapper = new BeforeEditPositionMapper(edits, lengthOfString(newLines.join('\n')));
const result = new Array<string>();
let lineIdx = 0;
for (const line of newLines) {
let lineLine = '';
let colLine = '';
let lineStr = '';
let colDist = '';
let lineDist = '';
for (let colIdx = 0; colIdx <= line.length; colIdx++) {
const before = mapper.getOffsetBeforeChange(toLength(lineIdx, colIdx));
const beforeObj = lengthToObj(before);
if (colIdx < line.length) {
lineStr += rightPad(line[colIdx], 3);
}
lineLine += rightPad('' + beforeObj.lineCount, 3);
colLine += rightPad('' + beforeObj.columnCount, 3);
const dist = lengthToObj(mapper.getDistanceToNextChange(toLength(lineIdx, colIdx)));
lineDist += rightPad('' + dist.lineCount, 3);
colDist += rightPad('' + dist.columnCount, 3);
}
result.push(lineStr);
result.push(lineLine);
result.push(colLine);
result.push(lineDist);
result.push(colDist);
lineIdx++;
}
return result;
}
export class TextEdit extends TextEditInfo {
constructor(
startOffset: Length,
endOffset: Length,
public readonly newText: string
) {
super(
startOffset,
endOffset,
lengthOfString(newText)
);
}
}
class PositionOffsetTransformer {
private readonly lineStartOffsetByLineIdx: number[];
constructor(text: string) {
this.lineStartOffsetByLineIdx = [];
this.lineStartOffsetByLineIdx.push(0);
for (let i = 0; i < text.length; i++) {
if (text.charAt(i) === '\n') {
this.lineStartOffsetByLineIdx.push(i + 1);
}
}
}
getOffset(position: Position): number {
return this.lineStartOffsetByLineIdx[position.lineNumber - 1] + position.column - 1;
}
}
function applyLineColumnEdits(text: string, edits: { range: IRange; text: string }[]): string {
const transformer = new PositionOffsetTransformer(text);
const offsetEdits = edits.map(e => {
const range = Range.lift(e.range);
return ({
startOffset: transformer.getOffset(range.getStartPosition()),
endOffset: transformer.getOffset(range.getEndPosition()),
text: e.text
});
});
offsetEdits.sort((a, b) => b.startOffset - a.startOffset);
for (const edit of offsetEdits) {
text = text.substring(0, edit.startOffset) + edit.text + text.substring(edit.endOffset);
}
return text;
}
function rightPad(str: string, len: number): string {
while (str.length < len) {
str += ' ';
}
return str;
}
| src/vs/editor/test/common/model/bracketPairColorizer/beforeEditPositionMapper.test.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.000205653952434659,
0.00017446477431803942,
0.00016814196715131402,
0.00017423056124243885,
0.000005207454250921728
]
|
{
"id": 11,
"code_window": [
"\t\t\tdefault:\n",
"\t\t\t\treturn false;\n",
"\t\t}\n",
"\t}\n",
"\tprivate async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);\n",
"\t\tif (setting === UpdateLinksOnFileMoveSetting.Never) {\n",
"\t\t\treturn false;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tprivate async shouldParticipateInLinkUpdate(newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 97
} | test/**
cgmanifest.json
| extensions/bat/.vscodeignore | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001771135866874829,
0.0001771135866874829,
0.0001771135866874829,
0.0001771135866874829,
0
]
|
{
"id": 11,
"code_window": [
"\t\t\tdefault:\n",
"\t\t\t\treturn false;\n",
"\t\t}\n",
"\t}\n",
"\tprivate async shouldParticipateInLinkUpdate(config: vscode.WorkspaceConfiguration, newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst setting = config.get<UpdateLinksOnFileMoveSetting>(settingNames.enabled);\n",
"\t\tif (setting === UpdateLinksOnFileMoveSetting.Never) {\n",
"\t\t\treturn false;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\tprivate async shouldParticipateInLinkUpdate(newUri: vscode.Uri): Promise<boolean> {\n",
"\t\tconst config = vscode.workspace.getConfiguration('markdown', newUri);\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 97
} | name: info-needed Closer
on:
schedule:
- cron: 20 11 * * * # 4:20am Redmond
repository_dispatch:
types: [trigger-needs-more-info]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: "microsoft/vscode-github-triage-actions"
path: ./actions
ref: stable
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run info-needed Closer
uses: ./actions/needs-more-info-closer
with:
appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
token: ${{secrets.VSCODE_ISSUE_TRIAGE_BOT_PAT}}
label: info-needed
closeDays: 7
additionalTeam: "cleidigh|usernamehw|gjsjohnmurray|IllusionMH"
closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
pingDays: 80
pingComment: "Hey @${assignee}, this issue might need further attention.\n\n@${author}, you can help us out by closing this issue if the problem no longer exists, or adding more information."
| .github/workflows/needs-more-info-closer.yml | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017791215213946998,
0.00017294968711212277,
0.00016861721815075725,
0.00017263469635508955,
0.0000034291279007447883
]
|
{
"id": 12,
"code_window": [
"\n",
"\t\treturn vscode.ConfigurationTarget.Global;\n",
"\t}\n",
"}\n",
"\n",
"export function registerUpdateLinksOnRename(client: MdLanguageClient) {\n",
"\treturn new UpdateLinksOnFileRenameHandler(client);\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"export function registerUpdateLinksOnRename(client: MdLanguageClient): vscode.Disposable {\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 232
} | {
"displayName": "Markdown Language Features",
"description": "Provides rich language support for Markdown.",
"markdown.preview.breaks.desc": "Sets how line-breaks are rendered in the Markdown preview. Setting it to 'true' creates a <br> for newlines inside paragraphs.",
"markdown.preview.linkify": "Enable or disable conversion of URL-like text to links in the Markdown preview.",
"markdown.preview.typographer": "Enable or disable some language-neutral replacement and quotes beautification in the Markdown preview.",
"markdown.preview.doubleClickToSwitchToEditor.desc": "Double click in the Markdown preview to switch to the editor.",
"markdown.preview.fontFamily.desc": "Controls the font family used in the Markdown preview.",
"markdown.preview.fontSize.desc": "Controls the font size in pixels used in the Markdown preview.",
"markdown.preview.lineHeight.desc": "Controls the line height used in the Markdown preview. This number is relative to the font size.",
"markdown.preview.markEditorSelection.desc": "Mark the current editor selection in the Markdown preview.",
"markdown.preview.scrollEditorWithPreview.desc": "When a Markdown preview is scrolled, update the view of the editor.",
"markdown.preview.scrollPreviewWithEditor.desc": "When a Markdown editor is scrolled, update the view of the preview.",
"markdown.preview.title": "Open Preview",
"markdown.previewSide.title": "Open Preview to the Side",
"markdown.showLockedPreviewToSide.title": "Open Locked Preview to the Side",
"markdown.showSource.title": "Show Source",
"markdown.styles.dec": "A list of URLs or local paths to CSS style sheets to use from the Markdown preview. Relative paths are interpreted relative to the folder open in the Explorer. If there is no open folder, they are interpreted relative to the location of the Markdown file. All '\\' need to be written as '\\\\'.",
"markdown.showPreviewSecuritySelector.title": "Change Preview Security Settings",
"markdown.trace.extension.desc": "Enable debug logging for the Markdown extension.",
"markdown.trace.server.desc": "Traces the communication between VS Code and the Markdown language server.",
"markdown.preview.refresh.title": "Refresh Preview",
"markdown.preview.toggleLock.title": "Toggle Preview Locking",
"markdown.findAllFileReferences": "Find File References",
"configuration.markdown.preview.openMarkdownLinks.description": "Controls how links to other Markdown files in the Markdown preview should be opened.",
"configuration.markdown.preview.openMarkdownLinks.inEditor": "Try to open links in the editor.",
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the Markdown preview.",
"configuration.markdown.links.openLocation.description": "Controls where links in Markdown files should be opened.",
"configuration.markdown.links.openLocation.currentGroup": "Open links in the active editor group.",
"configuration.markdown.links.openLocation.beside": "Open links beside the active editor.",
"configuration.markdown.suggest.paths.enabled.description": "Enable/disable path suggestions for markdown links",
"configuration.markdown.editor.drop.enabled": "Enable/disable dropping into the markdown editor to insert shift. Requires enabling `#editor.dropIntoEditor.enabled#`.",
"configuration.markdown.editor.pasteLinks.enabled": "Enable/disable pasting files into a Markdown editor inserts Markdown links. Requires enabling `#editor.experimental.pasteActions.enabled#`.",
"configuration.markdown.validate.enabled.description": "Enable/disable all error reporting in Markdown files.",
"configuration.markdown.validate.referenceLinks.enabled.description": "Validate reference links in Markdown files, e.g. `[link][ref]`. Requires enabling `#markdown.validate.enabled#`.",
"configuration.markdown.validate.fragmentLinks.enabled.description": "Validate fragment links to headers in the current Markdown file, e.g. `[link](#header)`. Requires enabling `#markdown.validate.enabled#`.",
"configuration.markdown.validate.fileLinks.enabled.description": "Validate links to other files in Markdown files, e.g. `[link](/path/to/file.md)`. This checks that the target files exists. Requires enabling `#markdown.validate.enabled#`.",
"configuration.markdown.validate.fileLinks.markdownFragmentLinks.description": "Validate the fragment part of links to headers in other files in Markdown files, e.g. `[link](/path/to/file.md#header)`. Inherits the setting value from `#markdown.validate.fragmentLinks.enabled#` by default.",
"configuration.markdown.validate.ignoredLinks.description": "Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.",
"configuration.markdown.validate.unusedLinkDefinitions.description": "Validate link definitions that are unused in the current file.",
"configuration.markdown.validate.duplicateLinkDefinitions.description": "Validate duplicated definitions in the current file.",
"configuration.markdown.experimental.updateLinksOnFileMove.enabled": "Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.experimental.updateLinksOnFileMove.externalFileGlobs#` to configure which files trigger link updates.",
"configuration.markdown.experimental.updateLinksOnFileMove.enabled.prompt": "Prompt on each file move.",
"configuration.markdown.experimental.updateLinksOnFileMove.enabled.always": "Always update links automatically.",
"configuration.markdown.experimental.updateLinksOnFileMove.enabled.never": "Never try to update link and don't prompt.",
"configuration.markdown.experimental.updateLinksOnFileMove.fileGlobs": "A glob that specifies which files besides markdown should trigger a link update.",
"configuration.markdown.experimental.updateLinksOnFileMove.enableForDirectories": "enable/disable updating links when a directory is moved or renamed in the workspace.",
"workspaceTrust": "Required for loading styles configured in the workspace."
}
| extensions/markdown-language-features/package.nls.json | 1 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0009332657791674137,
0.0003229844442103058,
0.0001645208103582263,
0.0001658927067182958,
0.00030524484463967383
]
|
{
"id": 12,
"code_window": [
"\n",
"\t\treturn vscode.ConfigurationTarget.Global;\n",
"\t}\n",
"}\n",
"\n",
"export function registerUpdateLinksOnRename(client: MdLanguageClient) {\n",
"\treturn new UpdateLinksOnFileRenameHandler(client);\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"export function registerUpdateLinksOnRename(client: MdLanguageClient): vscode.Disposable {\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 232
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as browser from 'vs/base/browser/browser';
import * as arrays from 'vs/base/common/arrays';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import * as platform from 'vs/base/common/platform';
import { ElementSizeObserver } from 'vs/editor/browser/config/elementSizeObserver';
import { FontMeasurements } from 'vs/editor/browser/config/fontMeasurements';
import { migrateOptions } from 'vs/editor/browser/config/migrateOptions';
import { TabFocus } from 'vs/editor/browser/config/tabFocus';
import { ComputeOptionsMemory, ConfigurationChangedEvent, EditorOption, editorOptionsRegistry, FindComputedEditorOptionValueById, IComputedEditorOptions, IEditorOptions, IEnvironmentalOptions } from 'vs/editor/common/config/editorOptions';
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
import { BareFontInfo, FontInfo, IValidatedEditorOptions } from 'vs/editor/common/config/fontInfo';
import { IDimension } from 'vs/editor/common/core/dimension';
import { IEditorConfiguration } from 'vs/editor/common/config/editorConfiguration';
import { AccessibilitySupport, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
export interface IEditorConstructionOptions extends IEditorOptions {
/**
* The initial editor dimension (to avoid measuring the container).
*/
dimension?: IDimension;
/**
* Place overflow widgets inside an external DOM node.
* Defaults to an internal DOM node.
*/
overflowWidgetsDomNode?: HTMLElement;
}
export class EditorConfiguration extends Disposable implements IEditorConfiguration {
private _onDidChange = this._register(new Emitter<ConfigurationChangedEvent>());
public readonly onDidChange: Event<ConfigurationChangedEvent> = this._onDidChange.event;
private _onDidChangeFast = this._register(new Emitter<ConfigurationChangedEvent>());
public readonly onDidChangeFast: Event<ConfigurationChangedEvent> = this._onDidChangeFast.event;
public readonly isSimpleWidget: boolean;
private readonly _containerObserver: ElementSizeObserver;
private _isDominatedByLongLines: boolean = false;
private _viewLineCount: number = 1;
private _lineNumbersDigitCount: number = 1;
private _reservedHeight: number = 0;
private readonly _computeOptionsMemory: ComputeOptionsMemory = new ComputeOptionsMemory();
/**
* Raw options as they were passed in and merged with all calls to `updateOptions`.
*/
private readonly _rawOptions: IEditorOptions;
/**
* Validated version of `_rawOptions`.
*/
private _validatedOptions: ValidatedEditorOptions;
/**
* Complete options which are a combination of passed in options and env values.
*/
public options: ComputedEditorOptions;
constructor(
isSimpleWidget: boolean,
options: Readonly<IEditorConstructionOptions>,
container: HTMLElement | null,
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService
) {
super();
this.isSimpleWidget = isSimpleWidget;
this._containerObserver = this._register(new ElementSizeObserver(container, options.dimension));
this._rawOptions = deepCloneAndMigrateOptions(options);
this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);
this.options = this._computeOptions();
if (this.options.get(EditorOption.automaticLayout)) {
this._containerObserver.startObserving();
}
this._register(EditorZoom.onDidChangeZoomLevel(() => this._recomputeOptions()));
this._register(TabFocus.onDidChangeTabFocus(() => this._recomputeOptions()));
this._register(this._containerObserver.onDidChange(() => this._recomputeOptions()));
this._register(FontMeasurements.onDidChange(() => this._recomputeOptions()));
this._register(browser.PixelRatio.onDidChange(() => this._recomputeOptions()));
this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions()));
}
private _recomputeOptions(): void {
const newOptions = this._computeOptions();
const changeEvent = EditorOptionsUtil.checkEquals(this.options, newOptions);
if (changeEvent === null) {
// nothing changed!
return;
}
this.options = newOptions;
this._onDidChangeFast.fire(changeEvent);
this._onDidChange.fire(changeEvent);
}
private _computeOptions(): ComputedEditorOptions {
const partialEnv = this._readEnvConfiguration();
const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.pixelRatio, this.isSimpleWidget);
const fontInfo = this._readFontInfo(bareFontInfo);
const env: IEnvironmentalOptions = {
memory: this._computeOptionsMemory,
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight - this._reservedHeight,
fontInfo: fontInfo,
extraEditorClassName: partialEnv.extraEditorClassName,
isDominatedByLongLines: this._isDominatedByLongLines,
viewLineCount: this._viewLineCount,
lineNumbersDigitCount: this._lineNumbersDigitCount,
emptySelectionClipboard: partialEnv.emptySelectionClipboard,
pixelRatio: partialEnv.pixelRatio,
tabFocusMode: TabFocus.getTabFocusMode(),
accessibilitySupport: partialEnv.accessibilitySupport
};
return EditorOptionsUtil.computeOptions(this._validatedOptions, env);
}
protected _readEnvConfiguration(): IEnvConfiguration {
return {
extraEditorClassName: getExtraEditorClassName(),
outerWidth: this._containerObserver.getWidth(),
outerHeight: this._containerObserver.getHeight(),
emptySelectionClipboard: browser.isWebKit || browser.isFirefox,
pixelRatio: browser.PixelRatio.value,
accessibilitySupport: (
this._accessibilityService.isScreenReaderOptimized()
? AccessibilitySupport.Enabled
: this._accessibilityService.getAccessibilitySupport()
)
};
}
protected _readFontInfo(bareFontInfo: BareFontInfo): FontInfo {
return FontMeasurements.readFontInfo(bareFontInfo);
}
public getRawOptions(): IEditorOptions {
return this._rawOptions;
}
public updateOptions(_newOptions: Readonly<IEditorOptions>): void {
const newOptions = deepCloneAndMigrateOptions(_newOptions);
const didChange = EditorOptionsUtil.applyUpdate(this._rawOptions, newOptions);
if (!didChange) {
return;
}
this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);
this._recomputeOptions();
}
public observeContainer(dimension?: IDimension): void {
this._containerObserver.observe(dimension);
}
public setIsDominatedByLongLines(isDominatedByLongLines: boolean): void {
if (this._isDominatedByLongLines === isDominatedByLongLines) {
return;
}
this._isDominatedByLongLines = isDominatedByLongLines;
this._recomputeOptions();
}
public setModelLineCount(modelLineCount: number): void {
const lineNumbersDigitCount = digitCount(modelLineCount);
if (this._lineNumbersDigitCount === lineNumbersDigitCount) {
return;
}
this._lineNumbersDigitCount = lineNumbersDigitCount;
this._recomputeOptions();
}
public setViewLineCount(viewLineCount: number): void {
if (this._viewLineCount === viewLineCount) {
return;
}
this._viewLineCount = viewLineCount;
this._recomputeOptions();
}
public setReservedHeight(reservedHeight: number) {
if (this._reservedHeight === reservedHeight) {
return;
}
this._reservedHeight = reservedHeight;
this._recomputeOptions();
}
}
function digitCount(n: number): number {
let r = 0;
while (n) {
n = Math.floor(n / 10);
r++;
}
return r ? r : 1;
}
function getExtraEditorClassName(): string {
let extra = '';
if (!browser.isSafari && !browser.isWebkitWebView) {
// Use user-select: none in all browsers except Safari and native macOS WebView
extra += 'no-user-select ';
}
if (browser.isSafari) {
// See https://github.com/microsoft/vscode/issues/108822
extra += 'no-minimap-shadow ';
extra += 'enable-user-select ';
}
if (platform.isMacintosh) {
extra += 'mac ';
}
return extra;
}
export interface IEnvConfiguration {
extraEditorClassName: string;
outerWidth: number;
outerHeight: number;
emptySelectionClipboard: boolean;
pixelRatio: number;
accessibilitySupport: AccessibilitySupport;
}
class ValidatedEditorOptions implements IValidatedEditorOptions {
private readonly _values: any[] = [];
public _read<T>(option: EditorOption): T {
return this._values[option];
}
public get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T> {
return this._values[id];
}
public _write<T>(option: EditorOption, value: T): void {
this._values[option] = value;
}
}
export class ComputedEditorOptions implements IComputedEditorOptions {
private readonly _values: any[] = [];
public _read<T>(id: EditorOption): T {
if (id >= this._values.length) {
throw new Error('Cannot read uninitialized value');
}
return this._values[id];
}
public get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T> {
return this._read(id);
}
public _write<T>(id: EditorOption, value: T): void {
this._values[id] = value;
}
}
class EditorOptionsUtil {
public static validateOptions(options: IEditorOptions): ValidatedEditorOptions {
const result = new ValidatedEditorOptions();
for (const editorOption of editorOptionsRegistry) {
const value = (editorOption.name === '_never_' ? undefined : (options as any)[editorOption.name]);
result._write(editorOption.id, editorOption.validate(value));
}
return result;
}
public static computeOptions(options: ValidatedEditorOptions, env: IEnvironmentalOptions): ComputedEditorOptions {
const result = new ComputedEditorOptions();
for (const editorOption of editorOptionsRegistry) {
result._write(editorOption.id, editorOption.compute(env, result, options._read(editorOption.id)));
}
return result;
}
private static _deepEquals<T>(a: T, b: T): boolean {
if (typeof a !== 'object' || typeof b !== 'object' || !a || !b) {
return a === b;
}
if (Array.isArray(a) || Array.isArray(b)) {
return (Array.isArray(a) && Array.isArray(b) ? arrays.equals(a, b) : false);
}
if (Object.keys(a as unknown as object).length !== Object.keys(b as unknown as object).length) {
return false;
}
for (const key in a) {
if (!EditorOptionsUtil._deepEquals(a[key], b[key])) {
return false;
}
}
return true;
}
public static checkEquals(a: ComputedEditorOptions, b: ComputedEditorOptions): ConfigurationChangedEvent | null {
const result: boolean[] = [];
let somethingChanged = false;
for (const editorOption of editorOptionsRegistry) {
const changed = !EditorOptionsUtil._deepEquals(a._read(editorOption.id), b._read(editorOption.id));
result[editorOption.id] = changed;
if (changed) {
somethingChanged = true;
}
}
return (somethingChanged ? new ConfigurationChangedEvent(result) : null);
}
/**
* Returns true if something changed.
* Modifies `options`.
*/
public static applyUpdate(options: IEditorOptions, update: Readonly<IEditorOptions>): boolean {
let changed = false;
for (const editorOption of editorOptionsRegistry) {
if (update.hasOwnProperty(editorOption.name)) {
const result = editorOption.applyUpdate((options as any)[editorOption.name], (update as any)[editorOption.name]);
(options as any)[editorOption.name] = result.newValue;
changed = changed || result.didChange;
}
}
return changed;
}
}
function deepCloneAndMigrateOptions(_options: Readonly<IEditorOptions>): IEditorOptions {
const options = objects.deepClone(_options);
migrateOptions(options);
return options;
}
| src/vs/editor/browser/config/editorConfiguration.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00019298135885037482,
0.0001707096234895289,
0.0001632830681046471,
0.00016967166448011994,
0.000005030130978411762
]
|
{
"id": 12,
"code_window": [
"\n",
"\t\treturn vscode.ConfigurationTarget.Global;\n",
"\t}\n",
"}\n",
"\n",
"export function registerUpdateLinksOnRename(client: MdLanguageClient) {\n",
"\treturn new UpdateLinksOnFileRenameHandler(client);\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"export function registerUpdateLinksOnRename(client: MdLanguageClient): vscode.Disposable {\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 232
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { parse } from 'vs/base/common/path';
import { debounce, throttle } from 'vs/base/common/decorators';
import { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { ProcessItem } from 'vs/base/common/processes';
import { listProcesses } from 'vs/base/node/ps';
import { ILogService } from 'vs/platform/log/common/log';
const enum Constants {
/**
* The amount of time to throttle checks when the process receives output.
*/
InactiveThrottleDuration = 5000,
/**
* The amount of time to debounce check when the process receives input.
*/
ActiveDebounceDuration = 1000,
}
export const ignoreProcessNames: string[] = [];
/**
* Monitors a process for child processes, checking at differing times depending on input and output
* calls into the monitor.
*/
export class ChildProcessMonitor extends Disposable {
private _isDisposed: boolean = false;
private _hasChildProcesses: boolean = false;
private set hasChildProcesses(value: boolean) {
if (this._hasChildProcesses !== value) {
this._hasChildProcesses = value;
this._logService.debug('ChildProcessMonitor: Has child processes changed', value);
this._onDidChangeHasChildProcesses.fire(value);
}
}
/**
* Whether the process has child processes.
*/
get hasChildProcesses(): boolean { return this._hasChildProcesses; }
private readonly _onDidChangeHasChildProcesses = this._register(new Emitter<boolean>());
/**
* An event that fires when whether the process has child processes changes.
*/
readonly onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event;
constructor(
private readonly _pid: number,
@ILogService private readonly _logService: ILogService
) {
super();
}
override dispose() {
this._isDisposed = true;
super.dispose();
}
/**
* Input was triggered on the process.
*/
handleInput() {
this._refreshActive();
}
/**
* Output was triggered on the process.
*/
handleOutput() {
this._refreshInactive();
}
@debounce(Constants.ActiveDebounceDuration)
private async _refreshActive(): Promise<void> {
if (this._isDisposed) {
return;
}
try {
const processItem = await listProcesses(this._pid);
this.hasChildProcesses = this._processContainsChildren(processItem);
} catch (e) {
this._logService.debug('ChildProcessMonitor: Fetching process tree failed', e);
}
}
@throttle(Constants.InactiveThrottleDuration)
private _refreshInactive(): void {
this._refreshActive();
}
private _processContainsChildren(processItem: ProcessItem): boolean {
// No child processes
if (!processItem.children) {
return false;
}
// A single child process, handle special cases
if (processItem.children.length === 1) {
const item = processItem.children[0];
let cmd: string;
if (item.cmd.startsWith(`"`)) {
cmd = item.cmd.substring(1, item.cmd.indexOf(`"`, 1));
} else {
const spaceIndex = item.cmd.indexOf(` `);
if (spaceIndex === -1) {
cmd = item.cmd;
} else {
cmd = item.cmd.substring(0, spaceIndex);
}
}
return ignoreProcessNames.indexOf(parse(cmd).name) === -1;
}
// Fallback, count child processes
return processItem.children.length > 0;
}
}
| src/vs/platform/terminal/node/childProcessMonitor.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.0001755280391080305,
0.00017037733050528914,
0.00016596676141489297,
0.00017051323084160686,
0.0000031508600386587204
]
|
{
"id": 12,
"code_window": [
"\n",
"\t\treturn vscode.ConfigurationTarget.Global;\n",
"\t}\n",
"}\n",
"\n",
"export function registerUpdateLinksOnRename(client: MdLanguageClient) {\n",
"\treturn new UpdateLinksOnFileRenameHandler(client);\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"export function registerUpdateLinksOnRename(client: MdLanguageClient): vscode.Disposable {\n"
],
"file_path": "extensions/markdown-language-features/src/languageFeatures/linkUpdater.ts",
"type": "replace",
"edit_start_line_idx": 232
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as osLib from 'os';
import { Iterable } from 'vs/base/common/iterator';
import { Promises } from 'vs/base/common/async';
import { getNodeType, parse, ParseError } from 'vs/base/common/json';
import { Schemas } from 'vs/base/common/network';
import { basename, join } from 'vs/base/common/path';
import { isLinux, isWindows } from 'vs/base/common/platform';
import { ProcessItem } from 'vs/base/common/processes';
import { URI } from 'vs/base/common/uri';
import { virtualMachineHint } from 'vs/base/node/id';
import { IDirent, Promises as pfs } from 'vs/base/node/pfs';
import { listProcesses } from 'vs/base/node/ps';
import { IDiagnosticsService, IMachineInfo, IMainProcessDiagnostics, IRemoteDiagnosticError, IRemoteDiagnosticInfo, isRemoteDiagnosticError, IWorkspaceInformation, PerformanceInfo, SystemInfo, WorkspaceStatItem, WorkspaceStats } from 'vs/platform/diagnostics/common/diagnostics';
import { ByteSize } from 'vs/platform/files/common/files';
import { IProductService } from 'vs/platform/product/common/productService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspace } from 'vs/platform/workspace/common/workspace';
export interface VersionInfo {
vscodeVersion: string;
os: string;
}
export interface ProcessInfo {
cpu: number;
memory: number;
pid: number;
name: string;
}
interface ConfigFilePatterns {
tag: string;
filePattern: RegExp;
relativePathPattern?: RegExp;
}
const worksapceStatsCache = new Map<string, Promise<WorkspaceStats>>();
export async function collectWorkspaceStats(folder: string, filter: string[]): Promise<WorkspaceStats> {
const cacheKey = `${folder}::${filter.join(':')}`;
const cached = worksapceStatsCache.get(cacheKey);
if (cached) {
return cached;
}
const configFilePatterns: ConfigFilePatterns[] = [
{ tag: 'grunt.js', filePattern: /^gruntfile\.js$/i },
{ tag: 'gulp.js', filePattern: /^gulpfile\.js$/i },
{ tag: 'tsconfig.json', filePattern: /^tsconfig\.json$/i },
{ tag: 'package.json', filePattern: /^package\.json$/i },
{ tag: 'jsconfig.json', filePattern: /^jsconfig\.json$/i },
{ tag: 'tslint.json', filePattern: /^tslint\.json$/i },
{ tag: 'eslint.json', filePattern: /^eslint\.json$/i },
{ tag: 'tasks.json', filePattern: /^tasks\.json$/i },
{ tag: 'launch.json', filePattern: /^launch\.json$/i },
{ tag: 'settings.json', filePattern: /^settings\.json$/i },
{ tag: 'webpack.config.js', filePattern: /^webpack\.config\.js$/i },
{ tag: 'project.json', filePattern: /^project\.json$/i },
{ tag: 'makefile', filePattern: /^makefile$/i },
{ tag: 'sln', filePattern: /^.+\.sln$/i },
{ tag: 'csproj', filePattern: /^.+\.csproj$/i },
{ tag: 'cmake', filePattern: /^.+\.cmake$/i },
{ tag: 'github-actions', filePattern: /^.+\.ya?ml$/i, relativePathPattern: /^\.github(?:\/|\\)workflows$/i },
{ tag: 'devcontainer.json', filePattern: /^devcontainer\.json$/i },
{ tag: 'dockerfile', filePattern: /^(dockerfile|docker\-compose\.ya?ml)$/i }
];
const fileTypes = new Map<string, number>();
const configFiles = new Map<string, number>();
const MAX_FILES = 20000;
function collect(root: string, dir: string, filter: string[], token: { count: number; maxReached: boolean }): Promise<void> {
const relativePath = dir.substring(root.length + 1);
return Promises.withAsyncBody(async resolve => {
let files: IDirent[];
try {
files = await pfs.readdir(dir, { withFileTypes: true });
} catch (error) {
// Ignore folders that can't be read
resolve();
return;
}
if (token.count >= MAX_FILES) {
token.count += files.length;
token.maxReached = true;
resolve();
return;
}
let pending = files.length;
if (pending === 0) {
resolve();
return;
}
let filesToRead = files;
if (token.count + files.length > MAX_FILES) {
token.maxReached = true;
pending = MAX_FILES - token.count;
filesToRead = files.slice(0, pending);
}
token.count += files.length;
for (const file of filesToRead) {
if (file.isDirectory()) {
if (!filter.includes(file.name)) {
await collect(root, join(dir, file.name), filter, token);
}
if (--pending === 0) {
resolve();
return;
}
} else {
const index = file.name.lastIndexOf('.');
if (index >= 0) {
const fileType = file.name.substring(index + 1);
if (fileType) {
fileTypes.set(fileType, (fileTypes.get(fileType) ?? 0) + 1);
}
}
for (const configFile of configFilePatterns) {
if (configFile.relativePathPattern?.test(relativePath) !== false && configFile.filePattern.test(file.name)) {
configFiles.set(configFile.tag, (configFiles.get(configFile.tag) ?? 0) + 1);
}
}
if (--pending === 0) {
resolve();
return;
}
}
}
});
}
const statsPromise = Promises.withAsyncBody<WorkspaceStats>(async (resolve) => {
const token: { count: number; maxReached: boolean } = { count: 0, maxReached: false };
await collect(folder, folder, filter, token);
const launchConfigs = await collectLaunchConfigs(folder);
resolve({
configFiles: asSortedItems(configFiles),
fileTypes: asSortedItems(fileTypes),
fileCount: token.count,
maxFilesReached: token.maxReached,
launchConfigFiles: launchConfigs
});
});
worksapceStatsCache.set(cacheKey, statsPromise);
return statsPromise;
}
function asSortedItems(items: Map<string, number>): WorkspaceStatItem[] {
return [
...Iterable.map(items.entries(), ([name, count]) => ({ name: name, count: count }))
].sort((a, b) => b.count - a.count);
}
export function getMachineInfo(): IMachineInfo {
const machineInfo: IMachineInfo = {
os: `${osLib.type()} ${osLib.arch()} ${osLib.release()}`,
memory: `${(osLib.totalmem() / ByteSize.GB).toFixed(2)}GB (${(osLib.freemem() / ByteSize.GB).toFixed(2)}GB free)`,
vmHint: `${Math.round((virtualMachineHint.value() * 100))}%`,
};
const cpus = osLib.cpus();
if (cpus && cpus.length > 0) {
machineInfo.cpus = `${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`;
}
return machineInfo;
}
export async function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[]> {
try {
const launchConfigs = new Map<string, number>();
const launchConfig = join(folder, '.vscode', 'launch.json');
const contents = await pfs.readFile(launchConfig);
const errors: ParseError[] = [];
const json = parse(contents.toString(), errors);
if (errors.length) {
console.log(`Unable to parse ${launchConfig}`);
return [];
}
if (getNodeType(json) === 'object' && json['configurations']) {
for (const each of json['configurations']) {
const type = each['type'];
if (type) {
if (launchConfigs.has(type)) {
launchConfigs.set(type, launchConfigs.get(type)! + 1);
} else {
launchConfigs.set(type, 1);
}
}
}
}
return asSortedItems(launchConfigs);
} catch (error) {
return [];
}
}
export class DiagnosticsService implements IDiagnosticsService {
declare readonly _serviceBrand: undefined;
constructor(
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IProductService private readonly productService: IProductService
) { }
private formatMachineInfo(info: IMachineInfo): string {
const output: string[] = [];
output.push(`OS Version: ${info.os}`);
output.push(`CPUs: ${info.cpus}`);
output.push(`Memory (System): ${info.memory}`);
output.push(`VM: ${info.vmHint}`);
return output.join('\n');
}
private formatEnvironment(info: IMainProcessDiagnostics): string {
const output: string[] = [];
output.push(`Version: ${this.productService.nameShort} ${this.productService.version} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`);
output.push(`OS Version: ${osLib.type()} ${osLib.arch()} ${osLib.release()}`);
const cpus = osLib.cpus();
if (cpus && cpus.length > 0) {
output.push(`CPUs: ${cpus[0].model} (${cpus.length} x ${cpus[0].speed})`);
}
output.push(`Memory (System): ${(osLib.totalmem() / ByteSize.GB).toFixed(2)}GB (${(osLib.freemem() / ByteSize.GB).toFixed(2)}GB free)`);
if (!isWindows) {
output.push(`Load (avg): ${osLib.loadavg().map(l => Math.round(l)).join(', ')}`); // only provided on Linux/macOS
}
output.push(`VM: ${Math.round((virtualMachineHint.value() * 100))}%`);
output.push(`Screen Reader: ${info.screenReader ? 'yes' : 'no'}`);
output.push(`Process Argv: ${info.mainArguments.join(' ')}`);
output.push(`GPU Status: ${this.expandGPUFeatures(info.gpuFeatureStatus)}`);
return output.join('\n');
}
public async getPerformanceInfo(info: IMainProcessDiagnostics, remoteData: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<PerformanceInfo> {
return Promise.all([listProcesses(info.mainPID), this.formatWorkspaceMetadata(info)]).then(async result => {
let [rootProcess, workspaceInfo] = result;
let processInfo = this.formatProcessList(info, rootProcess);
remoteData.forEach(diagnostics => {
if (isRemoteDiagnosticError(diagnostics)) {
processInfo += `\n${diagnostics.errorMessage}`;
workspaceInfo += `\n${diagnostics.errorMessage}`;
} else {
processInfo += `\n\nRemote: ${diagnostics.hostName}`;
if (diagnostics.processes) {
processInfo += `\n${this.formatProcessList(info, diagnostics.processes)}`;
}
if (diagnostics.workspaceMetadata) {
workspaceInfo += `\n| Remote: ${diagnostics.hostName}`;
for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
const metadata = diagnostics.workspaceMetadata[folder];
let countMessage = `${metadata.fileCount} files`;
if (metadata.maxFilesReached) {
countMessage = `more than ${countMessage}`;
}
workspaceInfo += `| Folder (${folder}): ${countMessage}`;
workspaceInfo += this.formatWorkspaceStats(metadata);
}
}
}
});
return {
processInfo,
workspaceInfo
};
});
}
public async getSystemInfo(info: IMainProcessDiagnostics, remoteData: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<SystemInfo> {
const { memory, vmHint, os, cpus } = getMachineInfo();
const systemInfo: SystemInfo = {
os,
memory,
cpus,
vmHint,
processArgs: `${info.mainArguments.join(' ')}`,
gpuStatus: info.gpuFeatureStatus,
screenReader: `${info.screenReader ? 'yes' : 'no'}`,
remoteData
};
if (!isWindows) {
systemInfo.load = `${osLib.loadavg().map(l => Math.round(l)).join(', ')}`;
}
if (isLinux) {
systemInfo.linuxEnv = {
desktopSession: process.env['DESKTOP_SESSION'],
xdgSessionDesktop: process.env['XDG_SESSION_DESKTOP'],
xdgCurrentDesktop: process.env['XDG_CURRENT_DESKTOP'],
xdgSessionType: process.env['XDG_SESSION_TYPE']
};
}
return Promise.resolve(systemInfo);
}
public async getDiagnostics(info: IMainProcessDiagnostics, remoteDiagnostics: (IRemoteDiagnosticInfo | IRemoteDiagnosticError)[]): Promise<string> {
const output: string[] = [];
return listProcesses(info.mainPID).then(async rootProcess => {
// Environment Info
output.push('');
output.push(this.formatEnvironment(info));
// Process List
output.push('');
output.push(this.formatProcessList(info, rootProcess));
// Workspace Stats
if (info.windows.some(window => window.folderURIs && window.folderURIs.length > 0 && !window.remoteAuthority)) {
output.push('');
output.push('Workspace Stats: ');
output.push(await this.formatWorkspaceMetadata(info));
}
remoteDiagnostics.forEach(diagnostics => {
if (isRemoteDiagnosticError(diagnostics)) {
output.push(`\n${diagnostics.errorMessage}`);
} else {
output.push('\n\n');
output.push(`Remote: ${diagnostics.hostName}`);
output.push(this.formatMachineInfo(diagnostics.machineInfo));
if (diagnostics.processes) {
output.push(this.formatProcessList(info, diagnostics.processes));
}
if (diagnostics.workspaceMetadata) {
for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
const metadata = diagnostics.workspaceMetadata[folder];
let countMessage = `${metadata.fileCount} files`;
if (metadata.maxFilesReached) {
countMessage = `more than ${countMessage}`;
}
output.push(`Folder (${folder}): ${countMessage}`);
output.push(this.formatWorkspaceStats(metadata));
}
}
}
});
output.push('');
output.push('');
return output.join('\n');
});
}
private formatWorkspaceStats(workspaceStats: WorkspaceStats): string {
const output: string[] = [];
const lineLength = 60;
let col = 0;
const appendAndWrap = (name: string, count: number) => {
const item = ` ${name}(${count})`;
if (col + item.length > lineLength) {
output.push(line);
line = '| ';
col = line.length;
}
else {
col += item.length;
}
line += item;
};
// File Types
let line = '| File types:';
const maxShown = 10;
const max = workspaceStats.fileTypes.length > maxShown ? maxShown : workspaceStats.fileTypes.length;
for (let i = 0; i < max; i++) {
const item = workspaceStats.fileTypes[i];
appendAndWrap(item.name, item.count);
}
output.push(line);
// Conf Files
if (workspaceStats.configFiles.length >= 0) {
line = '| Conf files:';
col = 0;
workspaceStats.configFiles.forEach((item) => {
appendAndWrap(item.name, item.count);
});
output.push(line);
}
if (workspaceStats.launchConfigFiles.length > 0) {
let line = '| Launch Configs:';
workspaceStats.launchConfigFiles.forEach(each => {
const item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;
line += item;
});
output.push(line);
}
return output.join('\n');
}
private expandGPUFeatures(gpuFeatures: any): string {
const longestFeatureName = Math.max(...Object.keys(gpuFeatures).map(feature => feature.length));
// Make columns aligned by adding spaces after feature name
return Object.keys(gpuFeatures).map(feature => `${feature}: ${' '.repeat(longestFeatureName - feature.length)} ${gpuFeatures[feature]}`).join('\n ');
}
private formatWorkspaceMetadata(info: IMainProcessDiagnostics): Promise<string> {
const output: string[] = [];
const workspaceStatPromises: Promise<void>[] = [];
info.windows.forEach(window => {
if (window.folderURIs.length === 0 || !!window.remoteAuthority) {
return;
}
output.push(`| Window (${window.title})`);
window.folderURIs.forEach(uriComponents => {
const folderUri = URI.revive(uriComponents);
if (folderUri.scheme === Schemas.file) {
const folder = folderUri.fsPath;
workspaceStatPromises.push(collectWorkspaceStats(folder, ['node_modules', '.git']).then(stats => {
let countMessage = `${stats.fileCount} files`;
if (stats.maxFilesReached) {
countMessage = `more than ${countMessage}`;
}
output.push(`| Folder (${basename(folder)}): ${countMessage}`);
output.push(this.formatWorkspaceStats(stats));
}).catch(error => {
output.push(`| Error: Unable to collect workspace stats for folder ${folder} (${error.toString()})`);
}));
} else {
output.push(`| Folder (${folderUri.toString()}): Workspace stats not available.`);
}
});
});
return Promise.all(workspaceStatPromises)
.then(_ => output.join('\n'))
.catch(e => `Unable to collect workspace stats: ${e}`);
}
private formatProcessList(info: IMainProcessDiagnostics, rootProcess: ProcessItem): string {
const mapPidToWindowTitle = new Map<number, string>();
info.windows.forEach(window => mapPidToWindowTitle.set(window.pid, window.title));
const output: string[] = [];
output.push('CPU %\tMem MB\t PID\tProcess');
if (rootProcess) {
this.formatProcessItem(info.mainPID, mapPidToWindowTitle, output, rootProcess, 0);
}
return output.join('\n');
}
private formatProcessItem(mainPid: number, mapPidToWindowTitle: Map<number, string>, output: string[], item: ProcessItem, indent: number): void {
const isRoot = (indent === 0);
// Format name with indent
let name: string;
if (isRoot) {
name = item.pid === mainPid ? `${this.productService.applicationName} main` : 'remote agent';
} else {
name = `${' '.repeat(indent)} ${item.name}`;
if (item.name === 'window') {
name = `${name} (${mapPidToWindowTitle.get(item.pid)})`;
}
}
const memory = process.platform === 'win32' ? item.mem : (osLib.totalmem() * (item.mem / 100));
output.push(`${item.load.toFixed(0).padStart(5, ' ')}\t${(memory / ByteSize.MB).toFixed(0).padStart(6, ' ')}\t${item.pid.toFixed(0).padStart(6, ' ')}\t${name}`);
// Recurse into children if any
if (Array.isArray(item.children)) {
item.children.forEach(child => this.formatProcessItem(mainPid, mapPidToWindowTitle, output, child, indent + 1));
}
}
public async getWorkspaceFileExtensions(workspace: IWorkspace): Promise<{ extensions: string[] }> {
const items = new Set<string>();
for (const { uri } of workspace.folders) {
const folderUri = URI.revive(uri);
if (folderUri.scheme !== Schemas.file) {
continue;
}
const folder = folderUri.fsPath;
try {
const stats = await collectWorkspaceStats(folder, ['node_modules', '.git']);
stats.fileTypes.forEach(item => items.add(item.name));
} catch { }
}
return { extensions: [...items] };
}
public async reportWorkspaceStats(workspace: IWorkspaceInformation): Promise<void> {
for (const { uri } of workspace.folders) {
const folderUri = URI.revive(uri);
if (folderUri.scheme !== Schemas.file) {
continue;
}
const folder = folderUri.fsPath;
try {
const stats = await collectWorkspaceStats(folder, ['node_modules', '.git']);
type WorkspaceStatsClassification = {
owner: 'lramos15';
comment: 'Metadata related to the workspace';
'workspace.id': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'A UUID given to a workspace to identify it.' };
rendererSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The ID of the session' };
};
type WorkspaceStatsEvent = {
'workspace.id': string | undefined;
rendererSessionId: string;
};
this.telemetryService.publicLog2<WorkspaceStatsEvent, WorkspaceStatsClassification>('workspace.stats', {
'workspace.id': workspace.telemetryId,
rendererSessionId: workspace.rendererSessionId
});
type WorkspaceStatsFileClassification = {
owner: 'lramos15';
comment: 'Helps us gain insights into what type of files are being used in a workspace';
rendererSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The ID of the session.' };
type: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The type of file' };
count: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'How many types of that file are present' };
};
type WorkspaceStatsFileEvent = {
rendererSessionId: string;
type: string;
count: number;
};
stats.fileTypes.forEach(e => {
this.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.file', {
rendererSessionId: workspace.rendererSessionId,
type: e.name,
count: e.count
});
});
stats.launchConfigFiles.forEach(e => {
this.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.launchConfigFile', {
rendererSessionId: workspace.rendererSessionId,
type: e.name,
count: e.count
});
});
stats.configFiles.forEach(e => {
this.telemetryService.publicLog2<WorkspaceStatsFileEvent, WorkspaceStatsFileClassification>('workspace.stats.configFiles', {
rendererSessionId: workspace.rendererSessionId,
type: e.name,
count: e.count
});
});
} catch {
// Report nothing if collecting metadata fails.
}
}
}
}
| src/vs/platform/diagnostics/node/diagnosticsService.ts | 0 | https://github.com/microsoft/vscode/commit/e1a373defd153d84a95f0d274af6745d52523456 | [
0.00017918662342708558,
0.00017097288218792528,
0.0001650792983127758,
0.0001714080135570839,
0.000002792221721392707
]
|
{
"id": 0,
"code_window": [
"import React, { PureComponent } from 'react';\n",
"import { connect, ConnectedProps } from 'react-redux';\n",
"\n",
"import { NavModel } from '@grafana/data';\n",
"import { featureEnabled } from '@grafana/runtime';\n",
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { NavModelItem } from '@grafana/data';\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | import { css, cx } from '@emotion/css';
import React, { ComponentType, useEffect, useMemo, memo } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { GrafanaTheme2 } from '@grafana/data';
import {
Icon,
IconName,
LinkButton,
Pagination,
RadioButtonGroup,
Tooltip,
useStyles2,
FilterInput,
} from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
import { contextSrv } from 'app/core/core';
import PageLoader from '../../core/components/PageLoader/PageLoader';
import { getNavModel } from '../../core/selectors/navModel';
import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';
import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';
export interface FilterProps {
filters: UserFilter[];
onChange: (filter: any) => void;
className?: string;
}
const extraFilters: Array<ComponentType<FilterProps>> = [];
export const addExtraFilters = (filter: ComponentType<FilterProps>) => {
extraFilters.push(filter);
};
const mapDispatchToProps = {
fetchUsers,
changeQuery,
changePage,
changeFilter,
};
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
users: state.userListAdmin.users,
query: state.userListAdmin.query,
showPaging: state.userListAdmin.showPaging,
totalPages: state.userListAdmin.totalPages,
page: state.userListAdmin.page,
filters: state.userListAdmin.filters,
isLoading: state.userListAdmin.isLoading,
});
const connector = connect(mapStateToProps, mapDispatchToProps);
interface OwnProps {}
type Props = OwnProps & ConnectedProps<typeof connector>;
const UserListAdminPageUnConnected: React.FC<Props> = ({
fetchUsers,
navModel,
query,
changeQuery,
users,
showPaging,
totalPages,
page,
changePage,
changeFilter,
filters,
isLoading,
}) => {
const styles = useStyles2(getStyles);
useEffect(() => {
fetchUsers();
}, [fetchUsers]);
const showLicensedRole = useMemo(() => users.some((user) => user.licensedRole), [users]);
return (
<Page navModel={navModel}>
<Page.Contents>
<div className="page-action-bar">
<div className="gf-form gf-form--grow">
<FilterInput
placeholder="Search user by login, email, or name."
autoFocus={true}
value={query}
onChange={changeQuery}
/>
<RadioButtonGroup
options={[
{ label: 'All users', value: false },
{ label: 'Active last 30 days', value: true },
]}
onChange={(value) => changeFilter({ name: 'activeLast30Days', value })}
value={filters.find((f) => f.name === 'activeLast30Days')?.value}
className={styles.filter}
/>
{extraFilters.map((FilterComponent, index) => (
<FilterComponent key={index} filters={filters} onChange={changeFilter} className={styles.filter} />
))}
</div>
{contextSrv.hasPermission(AccessControlAction.UsersCreate) && (
<LinkButton href="admin/users/create" variant="primary">
New user
</LinkButton>
)}
</div>
{isLoading ? (
<PageLoader />
) : (
<>
<div className={cx(styles.table, 'admin-list-table')}>
<table className="filter-table form-inline filter-table--hover">
<thead>
<tr>
<th></th>
<th>Login</th>
<th>Email</th>
<th>Name</th>
<th>Belongs to</th>
{showLicensedRole && (
<th>
Licensed role{' '}
<Tooltip
placement="top"
content={
<>
Licensed role is based on a user's Org role (i.e. Viewer, Editor, Admin) and their
dashboard/folder permissions.{' '}
<a
className={styles.link}
target="_blank"
rel="noreferrer noopener"
href={
'https://grafana.com/docs/grafana/next/enterprise/license/license-restrictions/#active-users-limit'
}
>
Learn more
</a>
</>
}
>
<Icon name="question-circle" />
</Tooltip>
</th>
)}
<th>
Last active
<Tooltip placement="top" content="Time since user was seen using Grafana">
<Icon name="question-circle" />
</Tooltip>
</th>
<th style={{ width: '1%' }}></th>
</tr>
</thead>
<tbody>
{users.map((user) => (
<UserListItem user={user} showLicensedRole={showLicensedRole} key={user.id} />
))}
</tbody>
</table>
</div>
{showPaging && <Pagination numberOfPages={totalPages} currentPage={page} onNavigate={changePage} />}
</>
)}
</Page.Contents>
</Page>
);
};
const getUsersAriaLabel = (name: string) => {
return `Edit user's ${name} details`;
};
type UserListItemProps = {
user: UserDTO;
showLicensedRole: boolean;
};
const UserListItem = memo(({ user, showLicensedRole }: UserListItemProps) => {
const styles = useStyles2(getStyles);
const editUrl = `admin/users/edit/${user.id}`;
return (
<tr key={user.id}>
<td className="width-4 text-center link-td">
<a href={editUrl} aria-label={`Edit user's ${user.name} details`}>
<img className="filter-table__avatar" src={user.avatarUrl} alt={`Avatar for user ${user.name}`} />
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.login} aria-label={getUsersAriaLabel(user.name)}>
{user.login}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.email} aria-label={getUsersAriaLabel(user.name)}>
{user.email}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.name}
</a>
</td>
<td
className={styles.row}
title={
user.orgs?.length
? `The user is a member of the following organizations: ${user.orgs.map((org) => org.name).join(',')}`
: undefined
}
>
<OrgUnits units={user.orgs} icon={'building'} />
{user.isAdmin && (
<a href={editUrl} aria-label={getUsersAriaLabel(user.name)}>
<Tooltip placement="top" content="Grafana Admin">
<Icon name="shield" />
</Tooltip>
</a>
)}
</td>
{showLicensedRole && (
<td className={cx('link-td', styles.iconRow)}>
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.licensedRole === 'None' ? (
<span className={styles.disabled}>
Not assigned{' '}
<Tooltip placement="top" content="A licensed role will be assigned when this user signs in">
<Icon name="question-circle" />
</Tooltip>
</span>
) : (
user.licensedRole
)}
</a>
</td>
)}
<td className="link-td">
{user.lastSeenAtAge && (
<a
href={editUrl}
aria-label={`Last seen at ${user.lastSeenAtAge}. Follow to edit user's ${user.name} details.`}
>
{user.lastSeenAtAge === '10 years' ? <span className={styles.disabled}>Never</span> : user.lastSeenAtAge}
</a>
)}
</td>
<td className="text-right">
{Array.isArray(user.authLabels) && user.authLabels.length > 0 && (
<TagBadge label={user.authLabels[0]} removeIcon={false} count={0} />
)}
</td>
<td className="text-right">
{user.isDisabled && <span className="label label-tag label-tag--gray">Disabled</span>}
</td>
</tr>
);
});
UserListItem.displayName = 'UserListItem';
type OrgUnitProps = { units?: Unit[]; icon: IconName };
const OrgUnits = ({ units, icon }: OrgUnitProps) => {
const styles = useStyles2(getStyles);
if (!units?.length) {
return null;
}
return units.length > 1 ? (
<Tooltip
placement={'top'}
content={
<div className={styles.unitTooltip}>
{units?.map((unit) => (
<a
href={unit.url}
className={styles.link}
title={unit.name}
key={unit.name}
aria-label={`Edit ${unit.name}`}
>
{unit.name}
</a>
))}
</div>
}
>
<div className={styles.unitItem}>
<Icon name={icon} /> <span>{units.length}</span>
</div>
</Tooltip>
) : (
<a
href={units[0].url}
className={styles.unitItem}
title={units[0].name}
key={units[0].name}
aria-label={`Edit ${units[0].name}`}
>
<Icon name={icon} /> {units[0].name}
</a>
);
};
const getStyles = (theme: GrafanaTheme2) => {
return {
table: css`
margin-top: ${theme.spacing(3)};
`,
filter: css`
margin: 0 ${theme.spacing(1)};
`,
iconRow: css`
svg {
margin-left: ${theme.spacing(0.5)};
}
`,
row: css`
display: flex;
align-items: center;
height: 100% !important;
a {
padding: ${theme.spacing(0.5)} 0 !important;
}
`,
unitTooltip: css`
display: flex;
flex-direction: column;
`,
unitItem: css`
cursor: pointer;
padding: ${theme.spacing(0.5)} 0;
margin-right: ${theme.spacing(1)};
`,
disabled: css`
color: ${theme.colors.text.disabled};
`,
link: css`
color: inherit;
cursor: pointer;
text-decoration: underline;
`,
};
};
export default connector(UserListAdminPageUnConnected);
| public/app/features/admin/UserListAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0063437651842832565,
0.0003882858145516366,
0.000164555647643283,
0.00017668120563030243,
0.0010116095654666424
]
|
{
"id": 0,
"code_window": [
"import React, { PureComponent } from 'react';\n",
"import { connect, ConnectedProps } from 'react-redux';\n",
"\n",
"import { NavModel } from '@grafana/data';\n",
"import { featureEnabled } from '@grafana/runtime';\n",
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { NavModelItem } from '@grafana/data';\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | package elasticsearch
import (
"context"
"encoding/json"
"errors"
"fmt"
"strconv"
"github.com/Masterminds/semver"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
"github.com/grafana/grafana/pkg/infra/httpclient"
"github.com/grafana/grafana/pkg/infra/log"
es "github.com/grafana/grafana/pkg/tsdb/elasticsearch/client"
"github.com/grafana/grafana/pkg/tsdb/intervalv2"
)
var eslog = log.New("tsdb.elasticsearch")
type Service struct {
httpClientProvider httpclient.Provider
intervalCalculator intervalv2.Calculator
im instancemgmt.InstanceManager
}
func ProvideService(httpClientProvider httpclient.Provider) *Service {
eslog.Debug("initializing")
return &Service{
im: datasource.NewInstanceManager(newInstanceSettings()),
httpClientProvider: httpClientProvider,
intervalCalculator: intervalv2.NewCalculator(),
}
}
func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
dsInfo, err := s.getDSInfo(req.PluginContext)
if err != nil {
return &backend.QueryDataResponse{}, err
}
// Support for version after their end-of-life (currently <7.10.0) was removed
lastSupportedVersion, _ := semver.NewVersion("7.10.0")
if dsInfo.ESVersion.LessThan(lastSupportedVersion) {
return &backend.QueryDataResponse{}, fmt.Errorf("support for elasticsearch versions after their end-of-life (currently versions < 7.10) was removed")
}
if len(req.Queries) == 0 {
return &backend.QueryDataResponse{}, fmt.Errorf("query contains no queries")
}
client, err := es.NewClient(ctx, s.httpClientProvider, dsInfo, req.Queries[0].TimeRange)
if err != nil {
return &backend.QueryDataResponse{}, err
}
query := newTimeSeriesQuery(client, req.Queries, s.intervalCalculator)
return query.execute()
}
func newInstanceSettings() datasource.InstanceFactoryFunc {
return func(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
jsonData := map[string]interface{}{}
err := json.Unmarshal(settings.JSONData, &jsonData)
if err != nil {
return nil, fmt.Errorf("error reading settings: %w", err)
}
httpCliOpts, err := settings.HTTPClientOptions()
if err != nil {
return nil, fmt.Errorf("error getting http options: %w", err)
}
// Set SigV4 service namespace
if httpCliOpts.SigV4 != nil {
httpCliOpts.SigV4.Service = "es"
}
version, err := coerceVersion(jsonData["esVersion"])
if err != nil {
return nil, fmt.Errorf("elasticsearch version is required, err=%v", err)
}
timeField, ok := jsonData["timeField"].(string)
if !ok {
return nil, errors.New("timeField cannot be cast to string")
}
if timeField == "" {
return nil, errors.New("elasticsearch time field name is required")
}
interval, ok := jsonData["interval"].(string)
if !ok {
interval = ""
}
timeInterval, ok := jsonData["timeInterval"].(string)
if !ok {
timeInterval = ""
}
var maxConcurrentShardRequests float64
switch v := jsonData["maxConcurrentShardRequests"].(type) {
case float64:
maxConcurrentShardRequests = v
case string:
maxConcurrentShardRequests, err = strconv.ParseFloat(v, 64)
if err != nil {
maxConcurrentShardRequests = 256
}
default:
maxConcurrentShardRequests = 256
}
includeFrozen, ok := jsonData["includeFrozen"].(bool)
if !ok {
includeFrozen = false
}
xpack, ok := jsonData["xpack"].(bool)
if !ok {
xpack = false
}
model := es.DatasourceInfo{
ID: settings.ID,
URL: settings.URL,
HTTPClientOpts: httpCliOpts,
Database: settings.Database,
MaxConcurrentShardRequests: int64(maxConcurrentShardRequests),
ESVersion: version,
TimeField: timeField,
Interval: interval,
TimeInterval: timeInterval,
IncludeFrozen: includeFrozen,
XPack: xpack,
}
return model, nil
}
}
func (s *Service) getDSInfo(pluginCtx backend.PluginContext) (*es.DatasourceInfo, error) {
i, err := s.im.Get(pluginCtx)
if err != nil {
return nil, err
}
instance := i.(es.DatasourceInfo)
return &instance, nil
}
func coerceVersion(v interface{}) (*semver.Version, error) {
versionString, ok := v.(string)
if ok {
return semver.NewVersion(versionString)
}
versionNumber, ok := v.(float64)
if !ok {
return nil, fmt.Errorf("elasticsearch version %v, cannot be cast to int", v)
}
// Legacy version numbers (before Grafana 8)
// valid values were 2,5,56,60,70
switch int64(versionNumber) {
case 2:
return semver.NewVersion("2.0.0")
case 5:
return semver.NewVersion("5.0.0")
case 56:
return semver.NewVersion("5.6.0")
case 60:
return semver.NewVersion("6.0.0")
case 70:
return semver.NewVersion("7.0.0")
default:
return nil, fmt.Errorf("elasticsearch version=%d is not supported", int64(versionNumber))
}
}
| pkg/tsdb/elasticsearch/elasticsearch.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017774496518541127,
0.0001720987493172288,
0.00016676787345204502,
0.00017276401922572404,
0.0000029179959710745607
]
|
{
"id": 0,
"code_window": [
"import React, { PureComponent } from 'react';\n",
"import { connect, ConnectedProps } from 'react-redux';\n",
"\n",
"import { NavModel } from '@grafana/data';\n",
"import { featureEnabled } from '@grafana/runtime';\n",
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { NavModelItem } from '@grafana/data';\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | package logger
import (
"fmt"
)
var (
debugmode = false
)
func Debug(args ...interface{}) {
if debugmode {
fmt.Print(args...)
}
}
func Debugf(fmtString string, args ...interface{}) {
if debugmode {
fmt.Printf(fmtString, args...)
}
}
func Error(args ...interface{}) {
fmt.Print(args...)
}
func Errorf(fmtString string, args ...interface{}) {
fmt.Printf(fmtString, args...)
}
func Info(args ...interface{}) {
fmt.Print(args...)
}
func Infof(fmtString string, args ...interface{}) {
fmt.Printf(fmtString, args...)
}
func Warn(args ...interface{}) {
fmt.Print(args...)
}
func Warnf(fmtString string, args ...interface{}) {
fmt.Printf(fmtString, args...)
}
func SetDebug(value bool) {
debugmode = value
}
| pkg/cmd/grafana-cli/logger/logger.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017130328342318535,
0.00016760898870415986,
0.00016489176778122783,
0.0001679637935012579,
0.0000022327128590404755
]
|
{
"id": 0,
"code_window": [
"import React, { PureComponent } from 'react';\n",
"import { connect, ConnectedProps } from 'react-redux';\n",
"\n",
"import { NavModel } from '@grafana/data';\n",
"import { featureEnabled } from '@grafana/runtime';\n",
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { NavModelItem } from '@grafana/data';\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 3
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Alert, Button, LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import {
AppNotificationSeverity,
LdapError,
LdapUser,
StoreState,
SyncInfo,
LdapConnectionInfo,
AccessControlAction,
} from 'app/types';
import {
loadLdapState,
loadLdapSyncStatus,
loadUserMapping,
clearUserError,
clearUserMappingInfo,
} from '../state/actions';
import { LdapConnectionStatus } from './LdapConnectionStatus';
import { LdapSyncInfo } from './LdapSyncInfo';
import { LdapUserInfo } from './LdapUserInfo';
interface OwnProps extends GrafanaRouteComponentProps<{}, { username?: string }> {
navModel: NavModel;
ldapConnectionInfo: LdapConnectionInfo;
ldapUser?: LdapUser;
ldapSyncInfo?: SyncInfo;
ldapError?: LdapError;
userError?: LdapError;
}
interface State {
isLoading: boolean;
}
export class LdapPage extends PureComponent<Props, State> {
state = {
isLoading: true,
};
async componentDidMount() {
const { clearUserMappingInfo, queryParams } = this.props;
await clearUserMappingInfo();
await this.fetchLDAPStatus();
if (queryParams.username) {
await this.fetchUserMapping(queryParams.username);
}
this.setState({ isLoading: false });
}
async fetchLDAPStatus() {
const { loadLdapState, loadLdapSyncStatus } = this.props;
return Promise.all([loadLdapState(), loadLdapSyncStatus()]);
}
async fetchUserMapping(username: string) {
const { loadUserMapping } = this.props;
return await loadUserMapping(username);
}
search = (event: any) => {
event.preventDefault();
const username = event.target.elements['username'].value;
if (username) {
this.fetchUserMapping(username);
}
};
onClearUserError = () => {
this.props.clearUserError();
};
render() {
const { ldapUser, userError, ldapError, ldapSyncInfo, ldapConnectionInfo, navModel, queryParams } = this.props;
const { isLoading } = this.state;
const canReadLDAPUser = contextSrv.hasPermission(AccessControlAction.LDAPUsersRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
<>
{ldapError && ldapError.title && (
<div className="gf-form-group">
<Alert title={ldapError.title} severity={AppNotificationSeverity.Error}>
{ldapError.body}
</Alert>
</div>
)}
<LdapConnectionStatus ldapConnectionInfo={ldapConnectionInfo} />
{featureEnabled('ldapsync') && ldapSyncInfo && <LdapSyncInfo ldapSyncInfo={ldapSyncInfo} />}
{canReadLDAPUser && (
<>
<h3 className="page-heading">Test user mapping</h3>
<div className="gf-form-group">
<form onSubmit={this.search} className="gf-form-inline">
<FormField
label="Username"
labelWidth={8}
inputWidth={30}
type="text"
id="username"
name="username"
defaultValue={queryParams.username}
/>
<Button type="submit">Run</Button>
</form>
</div>
{userError && userError.title && (
<div className="gf-form-group">
<Alert
title={userError.title}
severity={AppNotificationSeverity.Error}
onRemove={this.onClearUserError}
>
{userError.body}
</Alert>
</div>
)}
{ldapUser && <LdapUserInfo ldapUser={ldapUser} showAttributeMapping={true} />}
</>
)}
</>
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'ldap'),
ldapConnectionInfo: state.ldap.connectionInfo,
ldapUser: state.ldap.user,
ldapSyncInfo: state.ldap.syncInfo,
userError: state.ldap.userError,
ldapError: state.ldap.ldapError,
});
const mapDispatchToProps = {
loadLdapState,
loadLdapSyncStatus,
loadUserMapping,
clearUserError,
clearUserMappingInfo,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(LdapPage);
| public/app/features/admin/ldap/LdapPage.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9891570806503296,
0.05862569436430931,
0.00016726471949368715,
0.00017581965948920697,
0.23263372480869293
]
|
{
"id": 1,
"code_window": [
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n",
"import { getNavModel } from 'app/core/selectors/navModel';\n",
"import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';\n",
"\n",
"import { UserLdapSyncInfo } from './UserLdapSyncInfo';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 8
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.39632970094680786,
0.021936919540166855,
0.0001663987204665318,
0.00027153309201821685,
0.08826211094856262
]
|
{
"id": 1,
"code_window": [
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n",
"import { getNavModel } from 'app/core/selectors/navModel';\n",
"import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';\n",
"\n",
"import { UserLdapSyncInfo } from './UserLdapSyncInfo';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 8
} | import { css } from '@emotion/css';
import React from 'react';
import { GrafanaTheme2, QueryEditorProps } from '@grafana/data';
import { FileDropzone, InlineField, InlineFieldRow, QueryField, RadioButtonGroup, useStyles2 } from '@grafana/ui';
import { JaegerDatasource } from '../datasource';
import { JaegerQuery, JaegerQueryType } from '../types';
import { SearchForm } from './SearchForm';
type Props = QueryEditorProps<JaegerDatasource, JaegerQuery>;
export function QueryEditor({ datasource, query, onChange, onRunQuery }: Props) {
const styles = useStyles2(getStyles);
const onChangeQuery = (value: string) => {
const nextQuery: JaegerQuery = { ...query, query: value };
onChange(nextQuery);
};
const renderEditorBody = () => {
switch (query.queryType) {
case 'search':
return <SearchForm datasource={datasource} query={query} onChange={onChange} />;
case 'upload':
return (
<div className={styles.fileDropzoneContainer}>
<FileDropzone
options={{ multiple: false }}
onLoad={(result) => {
datasource.uploadedJson = result;
onRunQuery();
}}
/>
</div>
);
default:
return (
<InlineFieldRow>
<InlineField label="Trace ID" labelWidth={14} grow>
<QueryField
query={query.query}
onChange={onChangeQuery}
onRunQuery={onRunQuery}
onBlur={() => {}}
placeholder={'Enter a Trace ID (run with Shift+Enter)'}
portalOrigin="jaeger"
/>
</InlineField>
</InlineFieldRow>
);
}
};
return (
<>
<div className={styles.container}>
<InlineFieldRow>
<InlineField label="Query type">
<RadioButtonGroup<JaegerQueryType>
options={[
{ value: 'search', label: 'Search' },
{ value: undefined, label: 'TraceID' },
{ value: 'upload', label: 'JSON file' },
]}
value={query.queryType}
onChange={(v) =>
onChange({
...query,
queryType: v,
})
}
size="md"
/>
</InlineField>
</InlineFieldRow>
{renderEditorBody()}
</div>
</>
);
}
const getStyles = (theme: GrafanaTheme2) => ({
container: css`
width: 100%;
`,
fileDropzoneContainer: css`
padding: ${theme.spacing(2)};
`,
});
| public/app/plugins/datasource/jaeger/components/QueryEditor.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017272745026275516,
0.0001695371902314946,
0.00016561581287533045,
0.0001701587316347286,
0.0000025804770302784164
]
|
{
"id": 1,
"code_window": [
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n",
"import { getNavModel } from 'app/core/selectors/navModel';\n",
"import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';\n",
"\n",
"import { UserLdapSyncInfo } from './UserLdapSyncInfo';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 8
} | import { css } from '@emotion/css';
import { debounce, uniqueId } from 'lodash';
import React, { FormEvent, useState } from 'react';
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
import { Label, Icon, Input, Tooltip, RadioButtonGroup, useStyles2, Button, Field, Stack } from '@grafana/ui';
import { useQueryParams } from 'app/core/hooks/useQueryParams';
import { SilenceState } from 'app/plugins/datasource/alertmanager/types';
import { parseMatchers } from '../../utils/alertmanager';
import { getSilenceFiltersFromUrlParams } from '../../utils/misc';
const stateOptions: SelectableValue[] = Object.entries(SilenceState).map(([key, value]) => ({
label: key,
value,
}));
const getQueryStringKey = () => uniqueId('query-string-');
export const SilencesFilter = () => {
const [queryStringKey, setQueryStringKey] = useState(getQueryStringKey());
const [queryParams, setQueryParams] = useQueryParams();
const { queryString, silenceState } = getSilenceFiltersFromUrlParams(queryParams);
const styles = useStyles2(getStyles);
const handleQueryStringChange = debounce((e: FormEvent<HTMLInputElement>) => {
const target = e.target as HTMLInputElement;
setQueryParams({ queryString: target.value || null });
}, 400);
const handleSilenceStateChange = (state: string) => {
setQueryParams({ silenceState: state });
};
const clearFilters = () => {
setQueryParams({
queryString: null,
silenceState: null,
});
setTimeout(() => setQueryStringKey(getQueryStringKey()));
};
const inputInvalid = queryString && queryString.length > 3 ? parseMatchers(queryString).length === 0 : false;
return (
<div className={styles.flexRow}>
<Field
className={styles.rowChild}
label={
<Label>
<Stack gap={0.5}>
<span>Search by matchers</span>
<Tooltip
content={
<div>
Filter silences by matchers using a comma separated list of matchers, ie:
<pre>{`severity=critical, instance=~cluster-us-.+`}</pre>
</div>
}
>
<Icon name="info-circle" size="sm" />
</Tooltip>
</Stack>
</Label>
}
invalid={inputInvalid}
error={inputInvalid ? 'Query must use valid matcher syntax' : null}
>
<Input
key={queryStringKey}
className={styles.searchInput}
prefix={<Icon name="search" />}
onChange={handleQueryStringChange}
defaultValue={queryString ?? ''}
placeholder="Search"
data-testid="search-query-input"
/>
</Field>
<Field className={styles.rowChild} label="State">
<RadioButtonGroup options={stateOptions} value={silenceState} onChange={handleSilenceStateChange} />
</Field>
{(queryString || silenceState) && (
<div className={styles.rowChild}>
<Button variant="secondary" icon="times" onClick={clearFilters}>
Clear filters
</Button>
</div>
)}
</div>
);
};
const getStyles = (theme: GrafanaTheme2) => ({
searchInput: css`
width: 360px;
`,
flexRow: css`
display: flex;
flex-direction: row;
align-items: flex-end;
padding-bottom: ${theme.spacing(2)};
border-bottom: 1px solid ${theme.colors.border.strong};
`,
rowChild: css`
margin-right: ${theme.spacing(1)};
margin-bottom: 0;
max-height: 52px;
`,
fieldLabel: css`
font-size: 12px;
font-weight: 500;
`,
});
| public/app/features/alerting/unified/components/silences/SilencesFilter.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017698730516713113,
0.00017057669174391776,
0.00016593685722909868,
0.00017114609363488853,
0.0000033816825180110754
]
|
{
"id": 1,
"code_window": [
"import { Page } from 'app/core/components/Page/Page';\n",
"import { contextSrv } from 'app/core/core';\n",
"import { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n",
"import { getNavModel } from 'app/core/selectors/navModel';\n",
"import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';\n",
"\n",
"import { UserLdapSyncInfo } from './UserLdapSyncInfo';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 8
} | FROM ubuntu:20.04
ARG REPO_CONFIG=grafana.list.oss
ARG PACKAGE=grafana
RUN apt update && \
apt install -y curl \
ca-certificates \
gnupg && \
curl https://packages.grafana.com/gpg.key | apt-key add -
COPY "./$REPO_CONFIG" /etc/apt/sources.list.d/grafana.list
RUN apt update && \
apt install -y $PACKAGE
| scripts/verify-repo-update/Dockerfile.deb | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001681439025560394,
0.00016589966253377497,
0.00016365543706342578,
0.00016589966253377497,
0.000002244232746306807
]
|
{
"id": 2,
"code_window": [
"} from './state/actions';\n",
"\n",
"interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {\n",
" navModel: NavModel;\n",
" user?: UserDTO;\n",
" orgs: UserOrg[];\n",
" sessions: UserSession[];\n",
" ldapSyncInfo?: SyncInfo;\n",
" isLoading: boolean;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 33
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9990699887275696,
0.12265599519014359,
0.00016556844639126211,
0.002222307026386261,
0.3035777807235718
]
|
{
"id": 2,
"code_window": [
"} from './state/actions';\n",
"\n",
"interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {\n",
" navModel: NavModel;\n",
" user?: UserDTO;\n",
" orgs: UserOrg[];\n",
" sessions: UserSession[];\n",
" ldapSyncInfo?: SyncInfo;\n",
" isLoading: boolean;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 33
} | package notifications
import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
)
// AttachedFile struct represents email attached files.
type AttachedFile struct {
Name string
Content []byte
}
// Message is representation of the email message.
type Message struct {
To []string
SingleEmail bool
From string
Subject string
Body map[string]string
Info string
ReplyTo []string
EmbeddedFiles []string
AttachedFiles []*AttachedFile
}
func setDefaultTemplateData(cfg *setting.Cfg, data map[string]interface{}, u *user.User) {
data["AppUrl"] = setting.AppUrl
data["BuildVersion"] = setting.BuildVersion
data["BuildStamp"] = setting.BuildStamp
data["EmailCodeValidHours"] = cfg.EmailCodeValidMinutes / 60
data["Subject"] = map[string]interface{}{}
if u != nil {
data["Name"] = u.NameOrFallback()
}
}
| pkg/services/notifications/email.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001717756676953286,
0.00016930907440837473,
0.0001648375327931717,
0.0001703115412965417,
0.0000026791287837113487
]
|
{
"id": 2,
"code_window": [
"} from './state/actions';\n",
"\n",
"interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {\n",
" navModel: NavModel;\n",
" user?: UserDTO;\n",
" orgs: UserOrg[];\n",
" sessions: UserSession[];\n",
" ldapSyncInfo?: SyncInfo;\n",
" isLoading: boolean;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 33
} | import { RefObject, useEffect, useState } from 'react';
import { useEffectOnce } from 'react-use';
import { MenuItemElement } from './MenuItem';
const modulo = (a: number, n: number) => ((a % n) + n) % n;
const UNFOCUSED = -1;
/** @internal */
export interface UseMenuFocusProps {
localRef: RefObject<HTMLDivElement>;
isMenuOpen?: boolean;
openedWithArrow?: boolean;
setOpenedWithArrow?: (openedWithArrow: boolean) => void;
close?: () => void;
onOpen?: (focusOnItem: (itemId: number) => void) => void;
onClose?: () => void;
onKeyDown?: React.KeyboardEventHandler;
}
/** @internal */
export type UseMenuFocusReturn = [(event: React.KeyboardEvent) => void, () => void];
/** @internal */
export const useMenuFocus = ({
localRef,
isMenuOpen,
openedWithArrow,
setOpenedWithArrow,
close,
onOpen,
onClose,
onKeyDown,
}: UseMenuFocusProps): UseMenuFocusReturn => {
const [focusedItem, setFocusedItem] = useState(UNFOCUSED);
useEffect(() => {
if (isMenuOpen && openedWithArrow) {
setFocusedItem(0);
setOpenedWithArrow?.(false);
}
}, [isMenuOpen, openedWithArrow, setOpenedWithArrow]);
useEffect(() => {
const menuItems = localRef?.current?.querySelectorAll(`[data-role="menuitem"]`);
(menuItems?.[focusedItem] as MenuItemElement)?.focus();
menuItems?.forEach((menuItem, i) => {
(menuItem as MenuItemElement).tabIndex = i === focusedItem ? 0 : -1;
});
}, [localRef, focusedItem]);
useEffectOnce(() => {
const firstMenuItem = localRef?.current?.querySelector(`[data-role="menuitem"]`) as MenuItemElement | null;
if (firstMenuItem) {
firstMenuItem.tabIndex = 0;
}
onOpen?.(setFocusedItem);
});
const handleKeys = (event: React.KeyboardEvent) => {
const menuItems = localRef?.current?.querySelectorAll(`[data-role="menuitem"]`);
const menuItemsCount = menuItems?.length ?? 0;
switch (event.key) {
case 'ArrowUp':
event.preventDefault();
event.stopPropagation();
setFocusedItem(modulo(focusedItem - 1, menuItemsCount));
break;
case 'ArrowDown':
event.preventDefault();
event.stopPropagation();
setFocusedItem(modulo(focusedItem + 1, menuItemsCount));
break;
case 'ArrowLeft':
event.preventDefault();
event.stopPropagation();
setFocusedItem(UNFOCUSED);
close?.();
break;
case 'Home':
event.preventDefault();
event.stopPropagation();
setFocusedItem(0);
break;
case 'End':
event.preventDefault();
event.stopPropagation();
setFocusedItem(menuItemsCount - 1);
break;
case 'Enter':
event.preventDefault();
event.stopPropagation();
(menuItems?.[focusedItem] as MenuItemElement)?.click();
break;
case 'Escape':
event.preventDefault();
event.stopPropagation();
onClose?.();
break;
case 'Tab':
onClose?.();
break;
default:
break;
}
// Forward event to parent
onKeyDown?.(event);
};
const handleFocus = () => {
if (focusedItem === UNFOCUSED) {
setFocusedItem(0);
}
};
return [handleKeys, handleFocus];
};
| packages/grafana-ui/src/components/Menu/hooks.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017887490685097873,
0.00017557847604621202,
0.00016710245108697563,
0.00017622433369979262,
0.000003473470087556052
]
|
{
"id": 2,
"code_window": [
"} from './state/actions';\n",
"\n",
"interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {\n",
" navModel: NavModel;\n",
" user?: UserDTO;\n",
" orgs: UserOrg[];\n",
" sessions: UserSession[];\n",
" ldapSyncInfo?: SyncInfo;\n",
" isLoading: boolean;\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 33
} | import React, { PureComponent } from 'react';
import { Unsubscribable } from 'rxjs';
import { isLiveChannelMessageEvent, LiveChannelScope } from '@grafana/data';
import { getBackendSrv, getGrafanaLiveSrv } from '@grafana/runtime';
import { CommentView } from './CommentView';
import { Message, MessagePacket } from './types';
export interface Props {
objectType: string;
objectId: string;
}
export interface State {
messages: Message[];
value: string;
}
export class CommentManager extends PureComponent<Props, State> {
subscription?: Unsubscribable;
packetCounter = 0;
constructor(props: Props) {
super(props);
this.state = {
messages: [],
value: '',
};
}
async componentDidMount() {
const resp = await getBackendSrv().post('/api/comments/get', {
objectType: this.props.objectType,
objectId: this.props.objectId,
});
this.packetCounter++;
this.setState({
messages: resp.comments,
});
this.updateSubscription();
}
getLiveChannel = () => {
const live = getGrafanaLiveSrv();
if (!live) {
console.error('Grafana live not running, enable "live" feature toggle');
return undefined;
}
const address = this.getLiveAddress();
if (!address) {
return undefined;
}
return live.getStream<MessagePacket>(address);
};
getLiveAddress = () => {
return {
scope: LiveChannelScope.Grafana,
namespace: 'comment',
path: `${this.props.objectType}/${this.props.objectId}`,
};
};
updateSubscription = () => {
if (this.subscription) {
this.subscription.unsubscribe();
this.subscription = undefined;
}
const channel = this.getLiveChannel();
if (channel) {
this.subscription = channel.subscribe({
next: (msg) => {
if (isLiveChannelMessageEvent(msg)) {
const { commentCreated } = msg.message;
if (commentCreated) {
this.setState((prevState) => ({
messages: [...prevState.messages, commentCreated],
}));
this.packetCounter++;
}
}
},
});
}
};
addComment = async (comment: string): Promise<boolean> => {
const response = await getBackendSrv().post('/api/comments/create', {
objectType: this.props.objectType,
objectId: this.props.objectId,
content: comment,
});
// TODO: set up error handling
console.log(response);
return true;
};
render() {
return (
<CommentView comments={this.state.messages} packetCounter={this.packetCounter} addComment={this.addComment} />
);
}
}
| public/app/features/comments/CommentManager.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0004190694307908416,
0.00022774383251089603,
0.0001666321186348796,
0.0001772996038198471,
0.0000849968710099347
]
|
{
"id": 3,
"code_window": [
" };\n",
"\n",
" render() {\n",
" const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n",
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 105
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9989646673202515,
0.3684447705745697,
0.00016731960931792855,
0.004908605013042688,
0.47834837436676025
]
|
{
"id": 3,
"code_window": [
" };\n",
"\n",
" render() {\n",
" const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n",
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 105
} | package queryhistory
import (
"bytes"
"strings"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/user"
)
func writeStarredSQL(query SearchInQueryHistoryQuery, sqlStore *sqlstore.SQLStore, builder *sqlstore.SQLBuilder) {
if query.OnlyStarred {
builder.Write(sqlStore.Dialect.BooleanStr(true) + ` AS starred
FROM query_history
INNER JOIN query_history_star ON query_history_star.query_uid = query_history.uid
`)
} else {
builder.Write(` CASE WHEN query_history_star.query_uid IS NULL THEN ` + sqlStore.Dialect.BooleanStr(false) + ` ELSE ` + sqlStore.Dialect.BooleanStr(true) + ` END AS starred
FROM query_history
LEFT JOIN query_history_star ON query_history_star.query_uid = query_history.uid
`)
}
}
func writeFiltersSQL(query SearchInQueryHistoryQuery, user *user.SignedInUser, sqlStore *sqlstore.SQLStore, builder *sqlstore.SQLBuilder) {
params := []interface{}{user.OrgID, user.UserID, query.From, query.To, "%" + query.SearchString + "%", "%" + query.SearchString + "%"}
var sql bytes.Buffer
sql.WriteString(" WHERE query_history.org_id = ? AND query_history.created_by = ? AND query_history.created_at >= ? AND query_history.created_at <= ? AND (query_history.queries " + sqlStore.Dialect.LikeStr() + " ? OR query_history.comment " + sqlStore.Dialect.LikeStr() + " ?) ")
if len(query.DatasourceUIDs) > 0 {
for _, uid := range query.DatasourceUIDs {
params = append(params, uid)
}
sql.WriteString(" AND query_history.datasource_uid IN (? " + strings.Repeat(",?", len(query.DatasourceUIDs)-1) + ") ")
}
builder.Write(sql.String(), params...)
}
func writeSortSQL(query SearchInQueryHistoryQuery, sqlStore *sqlstore.SQLStore, builder *sqlstore.SQLBuilder) {
if query.Sort == "time-asc" {
builder.Write(" ORDER BY created_at ASC ")
} else {
builder.Write(" ORDER BY created_at DESC ")
}
}
func writeLimitSQL(query SearchInQueryHistoryQuery, sqlStore *sqlstore.SQLStore, builder *sqlstore.SQLBuilder) {
builder.Write(" LIMIT ? ", query.Limit)
}
func writeOffsetSQL(query SearchInQueryHistoryQuery, sqlStore *sqlstore.SQLStore, builder *sqlstore.SQLBuilder) {
builder.Write(" OFFSET ? ", query.Limit*(query.Page-1))
}
| pkg/services/queryhistory/writers.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017748211394064128,
0.00017104488506447524,
0.0001672235957812518,
0.00016972425510175526,
0.000003541849537214148
]
|
{
"id": 3,
"code_window": [
" };\n",
"\n",
" render() {\n",
" const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n",
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 105
} | package notifier
import (
"errors"
"fmt"
"time"
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
v2 "github.com/prometheus/alertmanager/api/v2"
"github.com/prometheus/alertmanager/silence"
)
var (
ErrGetSilencesInternal = fmt.Errorf("unable to retrieve silence(s) due to an internal error")
ErrDeleteSilenceInternal = fmt.Errorf("unable to delete silence due to an internal error")
ErrCreateSilenceBadPayload = fmt.Errorf("unable to create silence")
ErrListSilencesBadPayload = fmt.Errorf("unable to list silences")
ErrSilenceNotFound = silence.ErrNotFound
)
// ListSilences retrieves a list of stored silences. It supports a set of labels as filters.
func (am *Alertmanager) ListSilences(filter []string) (apimodels.GettableSilences, error) {
matchers, err := parseFilter(filter)
if err != nil {
am.logger.Error("failed to parse matchers", "err", err)
return nil, fmt.Errorf("%s: %w", ErrListSilencesBadPayload.Error(), err)
}
psils, _, err := am.silences.Query()
if err != nil {
am.logger.Error(ErrGetSilencesInternal.Error(), "err", err)
return nil, fmt.Errorf("%s: %w", ErrGetSilencesInternal.Error(), err)
}
sils := apimodels.GettableSilences{}
for _, ps := range psils {
if !v2.CheckSilenceMatchesFilterLabels(ps, matchers) {
continue
}
silence, err := v2.GettableSilenceFromProto(ps)
if err != nil {
am.logger.Error("unmarshaling from protobuf failed", "err", err)
return apimodels.GettableSilences{}, fmt.Errorf("%s: failed to convert internal silence to API silence: %w",
ErrGetSilencesInternal.Error(), err)
}
sils = append(sils, &silence)
}
v2.SortSilences(sils)
return sils, nil
}
// GetSilence retrieves a silence by the provided silenceID. It returns ErrSilenceNotFound if the silence is not present.
func (am *Alertmanager) GetSilence(silenceID string) (apimodels.GettableSilence, error) {
sils, _, err := am.silences.Query(silence.QIDs(silenceID))
if err != nil {
return apimodels.GettableSilence{}, fmt.Errorf("%s: %w", ErrGetSilencesInternal.Error(), err)
}
if len(sils) == 0 {
am.logger.Error("failed to find silence", "err", err, "id", sils)
return apimodels.GettableSilence{}, ErrSilenceNotFound
}
sil, err := v2.GettableSilenceFromProto(sils[0])
if err != nil {
am.logger.Error("unmarshaling from protobuf failed", "err", err)
return apimodels.GettableSilence{}, fmt.Errorf("%s: failed to convert internal silence to API silence: %w",
ErrGetSilencesInternal.Error(), err)
}
return sil, nil
}
// CreateSilence persists the provided silence and returns the silence ID if successful.
func (am *Alertmanager) CreateSilence(ps *apimodels.PostableSilence) (string, error) {
sil, err := v2.PostableSilenceToProto(ps)
if err != nil {
am.logger.Error("marshaling to protobuf failed", "err", err)
return "", fmt.Errorf("%s: failed to convert API silence to internal silence: %w",
ErrCreateSilenceBadPayload.Error(), err)
}
if sil.StartsAt.After(sil.EndsAt) || sil.StartsAt.Equal(sil.EndsAt) {
msg := "start time must be before end time"
am.logger.Error(msg, "err", "starts_at", sil.StartsAt, "ends_at", sil.EndsAt)
return "", fmt.Errorf("%s: %w", msg, ErrCreateSilenceBadPayload)
}
if sil.EndsAt.Before(time.Now()) {
msg := "end time can't be in the past"
am.logger.Error(msg, "ends_at", sil.EndsAt)
return "", fmt.Errorf("%s: %w", msg, ErrCreateSilenceBadPayload)
}
silenceID, err := am.silences.Set(sil)
if err != nil {
am.logger.Error("msg", "unable to save silence", "err", err)
if errors.Is(err, silence.ErrNotFound) {
return "", ErrSilenceNotFound
}
return "", fmt.Errorf("unable to save silence: %s: %w", err.Error(), ErrCreateSilenceBadPayload)
}
return silenceID, nil
}
// DeleteSilence looks for and expires the silence by the provided silenceID. It returns ErrSilenceNotFound if the silence is not present.
func (am *Alertmanager) DeleteSilence(silenceID string) error {
if err := am.silences.Expire(silenceID); err != nil {
if errors.Is(err, silence.ErrNotFound) {
return ErrSilenceNotFound
}
return fmt.Errorf("%s: %w", err.Error(), ErrDeleteSilenceInternal)
}
return nil
}
| pkg/services/ngalert/notifier/silences.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001759189326548949,
0.00017236318672075868,
0.00016824575141072273,
0.0001724339963402599,
0.0000020006827980978414
]
|
{
"id": 3,
"code_window": [
" };\n",
"\n",
" render() {\n",
" const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n",
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" const { user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 105
} | import './graph';
import './series_overrides_ctrl';
import './thresholds_form';
import './time_regions_form';
import './annotation_tooltip';
import './event_editor';
import { t } from '@lingui/macro';
import { auto } from 'angular';
import { defaults, find, without } from 'lodash';
import { DataFrame, FieldConfigProperty, PanelEvents, PanelPlugin } from '@grafana/data';
import { locationService } from '@grafana/runtime';
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
import config from 'app/core/config';
import TimeSeries from 'app/core/time_series2';
import { ThresholdMapper } from 'app/features/alerting/state/ThresholdMapper';
import { changePanelPlugin } from 'app/features/panel/state/actions';
import { dispatch } from 'app/store/store';
import { appEvents } from '../../../core/core';
import { loadSnapshotData } from '../../../features/dashboard/utils/loadSnapshotData';
import { annotationsFromDataFrames } from '../../../features/query/state/DashboardQueryRunner/utils';
import { ZoomOutEvent } from '../../../types/events';
import { GraphContextMenuCtrl } from './GraphContextMenuCtrl';
import { graphPanelMigrationHandler } from './GraphMigrations';
import { axesEditorComponent } from './axes_editor';
import { DataProcessor } from './data_processor';
import template from './template';
import { DataWarning, GraphFieldConfig, GraphPanelOptions } from './types';
import { getDataTimeRange } from './utils';
export class GraphCtrl extends MetricsPanelCtrl {
static template = template;
renderError = false;
hiddenSeries: any = {};
hiddenSeriesTainted = false;
seriesList: TimeSeries[] = [];
dataList: DataFrame[] = [];
annotations: any = [];
alertState: any;
dataWarning?: DataWarning;
colors: any = [];
subTabIndex = 0;
processor: DataProcessor;
contextMenuCtrl: GraphContextMenuCtrl;
panelDefaults: any = {
// datasource name, null = default datasource
datasource: null,
// sets client side (flot) or native graphite png renderer (png)
renderer: 'flot',
yaxes: [
{
label: null,
show: true,
logBase: 1,
min: null,
max: null,
format: 'short',
},
{
label: null,
show: true,
logBase: 1,
min: null,
max: null,
format: 'short',
},
],
xaxis: {
show: true,
mode: 'time',
name: null,
values: [],
buckets: null,
},
yaxis: {
align: false,
alignLevel: null,
},
// show/hide lines
lines: true,
// fill factor
fill: 1,
// fill gradient
fillGradient: 0,
// line width in pixels
linewidth: 1,
// show/hide dashed line
dashes: false,
// show/hide line
hiddenSeries: false,
// length of a dash
dashLength: 10,
// length of space between two dashes
spaceLength: 10,
// show hide points
points: false,
// point radius in pixels
pointradius: 2,
// show hide bars
bars: false,
// enable/disable stacking
stack: false,
// stack percentage mode
percentage: false,
// legend options
legend: {
show: true, // disable/enable legend
values: false, // disable/enable legend values
min: false,
max: false,
current: false,
total: false,
avg: false,
},
// how null points should be handled
nullPointMode: 'null',
// staircase line mode
steppedLine: false,
// tooltip options
tooltip: {
value_type: 'individual',
shared: true,
sort: 0,
},
// time overrides
timeFrom: null,
timeShift: null,
// metric queries
targets: [{}],
// series color overrides
aliasColors: {},
// other style overrides
seriesOverrides: [],
thresholds: [],
timeRegions: [],
options: {
// show/hide alert threshold lines and fill
alertThreshold: true,
},
};
/** @ngInject */
constructor($scope: any, $injector: auto.IInjectorService) {
super($scope, $injector);
defaults(this.panel, this.panelDefaults);
defaults(this.panel.tooltip, this.panelDefaults.tooltip);
defaults(this.panel.legend, this.panelDefaults.legend);
defaults(this.panel.xaxis, this.panelDefaults.xaxis);
defaults(this.panel.options, this.panelDefaults.options);
this.useDataFrames = true;
this.processor = new DataProcessor(this.panel);
this.contextMenuCtrl = new GraphContextMenuCtrl($scope);
this.events.on(PanelEvents.render, this.onRender.bind(this));
this.events.on(PanelEvents.dataFramesReceived, this.onDataFramesReceived.bind(this));
this.events.on(PanelEvents.dataSnapshotLoad, this.onDataSnapshotLoad.bind(this));
this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));
this.events.on(PanelEvents.initPanelActions, this.onInitPanelActions.bind(this));
// set axes format from field config
const fieldConfigUnit = this.panel.fieldConfig.defaults.unit;
if (fieldConfigUnit) {
this.panel.yaxes[0].format = fieldConfigUnit;
}
}
onInitEditMode() {
this.addEditorTab('Display', 'public/app/plugins/panel/graph/tab_display.html');
this.addEditorTab('Series overrides', 'public/app/plugins/panel/graph/tab_series_overrides.html');
this.addEditorTab('Axes', axesEditorComponent);
this.addEditorTab('Legend', 'public/app/plugins/panel/graph/tab_legend.html');
this.addEditorTab('Thresholds', 'public/app/plugins/panel/graph/tab_thresholds.html');
this.addEditorTab('Time regions', 'public/app/plugins/panel/graph/tab_time_regions.html');
this.subTabIndex = 0;
this.hiddenSeriesTainted = false;
}
onInitPanelActions(actions: any[]) {
const toggleTextTranslation = t({
id: 'panel.header-menu.more-toggle',
message: `Toggle legend`,
});
actions.push({ text: toggleTextTranslation, click: 'ctrl.toggleLegend()', shortcut: 'p l' });
}
zoomOut(evt: any) {
appEvents.publish(new ZoomOutEvent({ scale: 2 }));
}
onDataSnapshotLoad(snapshotData: any) {
const { series, annotations } = loadSnapshotData(this.panel, this.dashboard);
this.panelData!.annotations = annotations;
this.onDataFramesReceived(series);
}
onDataFramesReceived(data: DataFrame[]) {
this.dataList = data;
this.seriesList = this.processor.getSeriesList({
dataList: this.dataList,
range: this.range,
});
this.dataWarning = this.getDataWarning();
this.alertState = undefined;
(this.seriesList as any).alertState = undefined;
if (this.panelData!.alertState) {
this.alertState = this.panelData!.alertState;
(this.seriesList as any).alertState = this.alertState.state;
}
this.annotations = [];
if (this.panelData!.annotations?.length) {
this.annotations = annotationsFromDataFrames(this.panelData!.annotations);
}
this.loading = false;
this.render(this.seriesList);
}
getDataWarning(): DataWarning | undefined {
const datapointsCount = this.seriesList.reduce((prev, series) => {
return prev + series.datapoints.length;
}, 0);
if (datapointsCount === 0) {
if (this.dataList) {
for (const frame of this.dataList) {
if (frame.length && frame.fields?.length) {
return {
title: 'Unable to graph data',
tip: 'Data exists, but is not timeseries',
actionText: 'Switch to table view',
action: () => {
dispatch(changePanelPlugin({ panel: this.panel, pluginId: 'table' }));
},
};
}
}
}
return {
title: 'No data',
tip: 'No data returned from query',
};
}
// If any data is in range, do not return an error
for (const series of this.seriesList) {
if (!series.isOutsideRange) {
return undefined;
}
}
// All data is outside the time range
const dataWarning: DataWarning = {
title: 'Data outside time range',
tip: 'Can be caused by timezone mismatch or missing time filter in query',
};
const range = getDataTimeRange(this.dataList);
if (range) {
dataWarning.actionText = 'Zoom to data';
dataWarning.action = () => {
locationService.partial({
from: range.from,
to: range.to,
});
};
}
return dataWarning;
}
onRender() {
if (!this.seriesList) {
return;
}
ThresholdMapper.alertToGraphThresholds(this.panel);
for (const series of this.seriesList) {
series.applySeriesOverrides(this.panel.seriesOverrides);
// Always use the configured field unit
if (series.unit) {
this.panel.yaxes[series.yaxis - 1].format = series.unit;
}
if (this.hiddenSeriesTainted === false && series.hiddenSeries === true) {
this.hiddenSeries[series.alias] = true;
}
}
}
onColorChange = (series: any, color: string) => {
series.setColor(config.theme.visualization.getColorByName(color));
this.panel.aliasColors[series.alias] = color;
this.render();
};
onToggleSeries = (hiddenSeries: any) => {
this.hiddenSeriesTainted = true;
this.hiddenSeries = hiddenSeries;
this.render();
};
onToggleSort = (sortBy: any, sortDesc: any) => {
this.panel.legend.sort = sortBy;
this.panel.legend.sortDesc = sortDesc;
this.render();
};
onToggleAxis = (info: { alias: any; yaxis: any }) => {
let override: any = find(this.panel.seriesOverrides, { alias: info.alias });
if (!override) {
override = { alias: info.alias };
this.panel.seriesOverrides.push(override);
}
override.yaxis = info.yaxis;
this.render();
};
addSeriesOverride(override: any) {
this.panel.seriesOverrides.push(override || {});
}
removeSeriesOverride(override: any) {
this.panel.seriesOverrides = without(this.panel.seriesOverrides, override);
this.render();
}
toggleLegend() {
this.panel.legend.show = !this.panel.legend.show;
this.render();
}
legendValuesOptionChanged() {
const legend = this.panel.legend;
legend.values = legend.min || legend.max || legend.avg || legend.current || legend.total;
this.render();
}
onContextMenuClose = () => {
this.contextMenuCtrl.toggleMenu();
};
getTimeZone = () => this.dashboard.getTimezone();
getDataFrameByRefId = (refId: string) => {
return this.dataList.filter((dataFrame) => dataFrame.refId === refId)[0];
};
migrateToReact() {
this.onPluginTypeChange(config.panels['timeseries']);
}
}
// Use new react style configuration
export const plugin = new PanelPlugin<GraphPanelOptions, GraphFieldConfig>(null)
.useFieldConfig({
disableStandardOptions: [
FieldConfigProperty.NoValue,
FieldConfigProperty.Thresholds,
FieldConfigProperty.Max,
FieldConfigProperty.Min,
FieldConfigProperty.Decimals,
FieldConfigProperty.Color,
FieldConfigProperty.Mappings,
],
})
.setDataSupport({ annotations: true, alertStates: true })
.setMigrationHandler(graphPanelMigrationHandler);
// Use the angular ctrt rather than a react one
plugin.angularPanelCtrl = GraphCtrl;
| public/app/plugins/panel/graph/module.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9755932092666626,
0.09622837603092194,
0.00016632559709250927,
0.00017414818285033107,
0.2608928680419922
]
|
{
"id": 4,
"code_window": [
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n",
"\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" const pageNav: NavModelItem = {\n",
" text: user?.login ?? '',\n",
" };\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "add",
"edit_start_line_idx": 109
} | import { css, cx } from '@emotion/css';
import React, { ComponentType, useEffect, useMemo, memo } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { GrafanaTheme2 } from '@grafana/data';
import {
Icon,
IconName,
LinkButton,
Pagination,
RadioButtonGroup,
Tooltip,
useStyles2,
FilterInput,
} from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
import { contextSrv } from 'app/core/core';
import PageLoader from '../../core/components/PageLoader/PageLoader';
import { getNavModel } from '../../core/selectors/navModel';
import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';
import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';
export interface FilterProps {
filters: UserFilter[];
onChange: (filter: any) => void;
className?: string;
}
const extraFilters: Array<ComponentType<FilterProps>> = [];
export const addExtraFilters = (filter: ComponentType<FilterProps>) => {
extraFilters.push(filter);
};
const mapDispatchToProps = {
fetchUsers,
changeQuery,
changePage,
changeFilter,
};
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
users: state.userListAdmin.users,
query: state.userListAdmin.query,
showPaging: state.userListAdmin.showPaging,
totalPages: state.userListAdmin.totalPages,
page: state.userListAdmin.page,
filters: state.userListAdmin.filters,
isLoading: state.userListAdmin.isLoading,
});
const connector = connect(mapStateToProps, mapDispatchToProps);
interface OwnProps {}
type Props = OwnProps & ConnectedProps<typeof connector>;
const UserListAdminPageUnConnected: React.FC<Props> = ({
fetchUsers,
navModel,
query,
changeQuery,
users,
showPaging,
totalPages,
page,
changePage,
changeFilter,
filters,
isLoading,
}) => {
const styles = useStyles2(getStyles);
useEffect(() => {
fetchUsers();
}, [fetchUsers]);
const showLicensedRole = useMemo(() => users.some((user) => user.licensedRole), [users]);
return (
<Page navModel={navModel}>
<Page.Contents>
<div className="page-action-bar">
<div className="gf-form gf-form--grow">
<FilterInput
placeholder="Search user by login, email, or name."
autoFocus={true}
value={query}
onChange={changeQuery}
/>
<RadioButtonGroup
options={[
{ label: 'All users', value: false },
{ label: 'Active last 30 days', value: true },
]}
onChange={(value) => changeFilter({ name: 'activeLast30Days', value })}
value={filters.find((f) => f.name === 'activeLast30Days')?.value}
className={styles.filter}
/>
{extraFilters.map((FilterComponent, index) => (
<FilterComponent key={index} filters={filters} onChange={changeFilter} className={styles.filter} />
))}
</div>
{contextSrv.hasPermission(AccessControlAction.UsersCreate) && (
<LinkButton href="admin/users/create" variant="primary">
New user
</LinkButton>
)}
</div>
{isLoading ? (
<PageLoader />
) : (
<>
<div className={cx(styles.table, 'admin-list-table')}>
<table className="filter-table form-inline filter-table--hover">
<thead>
<tr>
<th></th>
<th>Login</th>
<th>Email</th>
<th>Name</th>
<th>Belongs to</th>
{showLicensedRole && (
<th>
Licensed role{' '}
<Tooltip
placement="top"
content={
<>
Licensed role is based on a user's Org role (i.e. Viewer, Editor, Admin) and their
dashboard/folder permissions.{' '}
<a
className={styles.link}
target="_blank"
rel="noreferrer noopener"
href={
'https://grafana.com/docs/grafana/next/enterprise/license/license-restrictions/#active-users-limit'
}
>
Learn more
</a>
</>
}
>
<Icon name="question-circle" />
</Tooltip>
</th>
)}
<th>
Last active
<Tooltip placement="top" content="Time since user was seen using Grafana">
<Icon name="question-circle" />
</Tooltip>
</th>
<th style={{ width: '1%' }}></th>
</tr>
</thead>
<tbody>
{users.map((user) => (
<UserListItem user={user} showLicensedRole={showLicensedRole} key={user.id} />
))}
</tbody>
</table>
</div>
{showPaging && <Pagination numberOfPages={totalPages} currentPage={page} onNavigate={changePage} />}
</>
)}
</Page.Contents>
</Page>
);
};
const getUsersAriaLabel = (name: string) => {
return `Edit user's ${name} details`;
};
type UserListItemProps = {
user: UserDTO;
showLicensedRole: boolean;
};
const UserListItem = memo(({ user, showLicensedRole }: UserListItemProps) => {
const styles = useStyles2(getStyles);
const editUrl = `admin/users/edit/${user.id}`;
return (
<tr key={user.id}>
<td className="width-4 text-center link-td">
<a href={editUrl} aria-label={`Edit user's ${user.name} details`}>
<img className="filter-table__avatar" src={user.avatarUrl} alt={`Avatar for user ${user.name}`} />
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.login} aria-label={getUsersAriaLabel(user.name)}>
{user.login}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.email} aria-label={getUsersAriaLabel(user.name)}>
{user.email}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.name}
</a>
</td>
<td
className={styles.row}
title={
user.orgs?.length
? `The user is a member of the following organizations: ${user.orgs.map((org) => org.name).join(',')}`
: undefined
}
>
<OrgUnits units={user.orgs} icon={'building'} />
{user.isAdmin && (
<a href={editUrl} aria-label={getUsersAriaLabel(user.name)}>
<Tooltip placement="top" content="Grafana Admin">
<Icon name="shield" />
</Tooltip>
</a>
)}
</td>
{showLicensedRole && (
<td className={cx('link-td', styles.iconRow)}>
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.licensedRole === 'None' ? (
<span className={styles.disabled}>
Not assigned{' '}
<Tooltip placement="top" content="A licensed role will be assigned when this user signs in">
<Icon name="question-circle" />
</Tooltip>
</span>
) : (
user.licensedRole
)}
</a>
</td>
)}
<td className="link-td">
{user.lastSeenAtAge && (
<a
href={editUrl}
aria-label={`Last seen at ${user.lastSeenAtAge}. Follow to edit user's ${user.name} details.`}
>
{user.lastSeenAtAge === '10 years' ? <span className={styles.disabled}>Never</span> : user.lastSeenAtAge}
</a>
)}
</td>
<td className="text-right">
{Array.isArray(user.authLabels) && user.authLabels.length > 0 && (
<TagBadge label={user.authLabels[0]} removeIcon={false} count={0} />
)}
</td>
<td className="text-right">
{user.isDisabled && <span className="label label-tag label-tag--gray">Disabled</span>}
</td>
</tr>
);
});
UserListItem.displayName = 'UserListItem';
type OrgUnitProps = { units?: Unit[]; icon: IconName };
const OrgUnits = ({ units, icon }: OrgUnitProps) => {
const styles = useStyles2(getStyles);
if (!units?.length) {
return null;
}
return units.length > 1 ? (
<Tooltip
placement={'top'}
content={
<div className={styles.unitTooltip}>
{units?.map((unit) => (
<a
href={unit.url}
className={styles.link}
title={unit.name}
key={unit.name}
aria-label={`Edit ${unit.name}`}
>
{unit.name}
</a>
))}
</div>
}
>
<div className={styles.unitItem}>
<Icon name={icon} /> <span>{units.length}</span>
</div>
</Tooltip>
) : (
<a
href={units[0].url}
className={styles.unitItem}
title={units[0].name}
key={units[0].name}
aria-label={`Edit ${units[0].name}`}
>
<Icon name={icon} /> {units[0].name}
</a>
);
};
const getStyles = (theme: GrafanaTheme2) => {
return {
table: css`
margin-top: ${theme.spacing(3)};
`,
filter: css`
margin: 0 ${theme.spacing(1)};
`,
iconRow: css`
svg {
margin-left: ${theme.spacing(0.5)};
}
`,
row: css`
display: flex;
align-items: center;
height: 100% !important;
a {
padding: ${theme.spacing(0.5)} 0 !important;
}
`,
unitTooltip: css`
display: flex;
flex-direction: column;
`,
unitItem: css`
cursor: pointer;
padding: ${theme.spacing(0.5)} 0;
margin-right: ${theme.spacing(1)};
`,
disabled: css`
color: ${theme.colors.text.disabled};
`,
link: css`
color: inherit;
cursor: pointer;
text-decoration: underline;
`,
};
};
export default connector(UserListAdminPageUnConnected);
| public/app/features/admin/UserListAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.009432519786059856,
0.0004996670759283006,
0.00016564597899559885,
0.00017312521231360734,
0.0015496357809752226
]
|
{
"id": 4,
"code_window": [
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n",
"\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" const pageNav: NavModelItem = {\n",
" text: user?.login ?? '',\n",
" };\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "add",
"edit_start_line_idx": 109
} | import { action } from '@storybook/addon-actions';
import { useArgs } from '@storybook/client-api';
import { ComponentMeta, ComponentStory } from '@storybook/react';
import React from 'react';
import { withCenteredStory, withHorizontallyCenteredStory } from '../../utils/storybook/withCenteredStory';
import { Collapse, ControlledCollapse } from './Collapse';
import mdx from './Collapse.mdx';
const EXCLUDED_PROPS = ['className', 'onToggle'];
const meta: ComponentMeta<typeof Collapse> = {
title: 'Layout/Collapse',
component: Collapse,
decorators: [withCenteredStory, withHorizontallyCenteredStory],
parameters: {
docs: {
page: mdx,
},
controls: {
exclude: EXCLUDED_PROPS,
},
},
args: {
children: 'Panel data',
isOpen: false,
label: 'Collapse panel',
collapsible: true,
},
argTypes: {
onToggle: { action: 'toggled' },
},
};
export const Basic: ComponentStory<typeof Collapse> = (args) => {
const [, updateArgs] = useArgs();
return (
<Collapse
{...args}
onToggle={() => {
action('onToggle')({ isOpen: !args.isOpen });
updateArgs({ isOpen: !args.isOpen });
}}
>
<p>{args.children}</p>
</Collapse>
);
};
export const Controlled: ComponentStory<typeof ControlledCollapse> = (args) => {
return (
<ControlledCollapse {...args}>
<p>{args.children}</p>
</ControlledCollapse>
);
};
Controlled.parameters = {
controls: {
exclude: [...EXCLUDED_PROPS, 'isOpen'],
},
};
export default meta;
| packages/grafana-ui/src/components/Collapse/Collapse.story.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017642471357248724,
0.0001741361484164372,
0.00017033301992341876,
0.0001744499895721674,
0.0000018237069525639527
]
|
{
"id": 4,
"code_window": [
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n",
"\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" const pageNav: NavModelItem = {\n",
" text: user?.login ?? '',\n",
" };\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "add",
"edit_start_line_idx": 109
} | import { VisualizationSuggestionsBuilder, VizOrientation } from '@grafana/data';
import { StackingMode, VisibilityMode } from '@grafana/schema';
import { SuggestionName } from 'app/types/suggestions';
import { PanelFieldConfig, PanelOptions } from './models.gen';
export class BarChartSuggestionsSupplier {
getListWithDefaults(builder: VisualizationSuggestionsBuilder) {
return builder.getListAppender<PanelOptions, PanelFieldConfig>({
name: SuggestionName.BarChart,
pluginId: 'barchart',
options: {
showValue: VisibilityMode.Never,
legend: {
showLegend: true,
placement: 'right',
} as any,
},
fieldConfig: {
defaults: {
unit: 'short',
custom: {},
},
overrides: [],
},
cardOptions: {
previewModifier: (s) => {
s.options!.barWidth = 0.8;
},
},
});
}
getSuggestionsForData(builder: VisualizationSuggestionsBuilder) {
const list = this.getListWithDefaults(builder);
const { dataSummary } = builder;
if (dataSummary.frameCount !== 1) {
return;
}
if (!dataSummary.hasNumberField || !dataSummary.hasStringField) {
return;
}
// if you have this many rows barchart might not be a good fit
if (dataSummary.rowCountTotal > 50) {
return;
}
// Vertical bars
list.append({
name: SuggestionName.BarChart,
});
if (dataSummary.numberFieldCount > 1) {
list.append({
name: SuggestionName.BarChartStacked,
options: {
stacking: StackingMode.Normal,
},
});
list.append({
name: SuggestionName.BarChartStackedPercent,
options: {
stacking: StackingMode.Percent,
},
});
}
// horizontal bars
list.append({
name: SuggestionName.BarChartHorizontal,
options: {
orientation: VizOrientation.Horizontal,
},
});
if (dataSummary.numberFieldCount > 1) {
list.append({
name: SuggestionName.BarChartHorizontalStacked,
options: {
stacking: StackingMode.Normal,
orientation: VizOrientation.Horizontal,
},
});
list.append({
name: SuggestionName.BarChartHorizontalStackedPercent,
options: {
orientation: VizOrientation.Horizontal,
stacking: StackingMode.Percent,
},
});
}
}
}
| public/app/plugins/panel/barchart/suggestions.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001784667110769078,
0.00017621900769881904,
0.0001722529559629038,
0.0001765042543411255,
0.0000015985174286470283
]
|
{
"id": 4,
"code_window": [
" const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');\n",
" const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);\n",
" const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);\n",
"\n",
" return (\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" const pageNav: NavModelItem = {\n",
" text: user?.login ?? '',\n",
" };\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "add",
"edit_start_line_idx": 109
} | // Code generated by MockGen. DO NOT EDIT.
// Source: github.com/grafana/grafana/pkg/components/imguploader (interfaces: ImageUploader)
// Package imguploader is a generated GoMock package.
package imguploader
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockImageUploader is a mock of ImageUploader interface.
type MockImageUploader struct {
ctrl *gomock.Controller
recorder *MockImageUploaderMockRecorder
}
// MockImageUploaderMockRecorder is the mock recorder for MockImageUploader.
type MockImageUploaderMockRecorder struct {
mock *MockImageUploader
}
// NewMockImageUploader creates a new mock instance.
func NewMockImageUploader(ctrl *gomock.Controller) *MockImageUploader {
mock := &MockImageUploader{ctrl: ctrl}
mock.recorder = &MockImageUploaderMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockImageUploader) EXPECT() *MockImageUploaderMockRecorder {
return m.recorder
}
// Upload mocks base method.
func (m *MockImageUploader) Upload(arg0 context.Context, arg1 string) (string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Upload", arg0, arg1)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Upload indicates an expected call of Upload.
func (mr *MockImageUploaderMockRecorder) Upload(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upload", reflect.TypeOf((*MockImageUploader)(nil).Upload), arg0, arg1)
}
| pkg/components/imguploader/mock.go | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017730890249367803,
0.00017012761963997036,
0.00016328041965607554,
0.000169413659023121,
0.0000048187243919528555
]
|
{
"id": 5,
"code_window": [
"\n",
" return (\n",
" <Page navModel={navModel}>\n",
" <Page.Contents isLoading={isLoading}>\n",
" {user && (\n",
" <>\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" <Page navId=\"global-users\" pageNav={pageNav} subTitle=\"Manage settings for an individual user.\">\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 111
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9886471629142761,
0.05462367832660675,
0.00016525630780961365,
0.0026174867525696754,
0.22016674280166626
]
|
{
"id": 5,
"code_window": [
"\n",
" return (\n",
" <Page navModel={navModel}>\n",
" <Page.Contents isLoading={isLoading}>\n",
" {user && (\n",
" <>\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" <Page navId=\"global-users\" pageNav={pageNav} subTitle=\"Manage settings for an individual user.\">\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 111
} | import { config } from '@grafana/runtime';
import { BlugeSearcher } from './bluge';
import { SQLSearcher } from './sql';
import { GrafanaSearcher } from './types';
let searcher: GrafanaSearcher | undefined = undefined;
export function getGrafanaSearcher(): GrafanaSearcher {
if (!searcher) {
const useBluge = config.featureToggles.panelTitleSearch;
searcher = useBluge ? new BlugeSearcher() : new SQLSearcher();
}
return searcher!;
}
| public/app/features/search/service/searcher.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001777412398951128,
0.0001766495406627655,
0.00017555782687850296,
0.0001766495406627655,
0.0000010917065083049238
]
|
{
"id": 5,
"code_window": [
"\n",
" return (\n",
" <Page navModel={navModel}>\n",
" <Page.Contents isLoading={isLoading}>\n",
" {user && (\n",
" <>\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" <Page navId=\"global-users\" pageNav={pageNav} subTitle=\"Manage settings for an individual user.\">\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 111
} | import { createErrorNotification, createSuccessNotification } from '../../core/copy/appNotification';
import { AppNotification } from '../../types';
import { PanelModel } from '../dashboard/state';
import { addLibraryPanel, updateLibraryPanel } from './state/api';
import { LibraryElementDTO, PanelModelLibraryPanel } from './types';
export function createPanelLibraryErrorNotification(message: string): AppNotification {
return createErrorNotification(message);
}
export function createPanelLibrarySuccessNotification(message: string): AppNotification {
return createSuccessNotification(message);
}
export function toPanelModelLibraryPanel(libraryPanelDto: LibraryElementDTO): PanelModelLibraryPanel {
const { uid, name, meta, version } = libraryPanelDto;
return { uid, name, meta, version };
}
export async function saveAndRefreshLibraryPanel(panel: PanelModel, folderId: number): Promise<LibraryElementDTO> {
const panelSaveModel = toPanelSaveModel(panel);
const savedPanel = await saveOrUpdateLibraryPanel(panelSaveModel, folderId);
updatePanelModelWithUpdate(panel, savedPanel);
return savedPanel;
}
function toPanelSaveModel(panel: PanelModel): any {
let panelSaveModel = panel.getSaveModel();
panelSaveModel = {
libraryPanel: {
name: panel.title,
uid: undefined,
},
...panelSaveModel,
};
return panelSaveModel;
}
function updatePanelModelWithUpdate(panel: PanelModel, updated: LibraryElementDTO): void {
panel.restoreModel({
...updated.model,
configRev: 0, // reset config rev, since changes have been saved
libraryPanel: toPanelModelLibraryPanel(updated),
title: panel.title,
});
panel.refresh();
}
function saveOrUpdateLibraryPanel(panel: any, folderId: number): Promise<LibraryElementDTO> {
if (!panel.libraryPanel) {
return Promise.reject();
}
if (panel.libraryPanel && panel.libraryPanel.uid === undefined) {
return addLibraryPanel(panel, folderId!);
}
return updateLibraryPanel(panel);
}
| public/app/features/library-panels/utils.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001787017099559307,
0.00017311576812062413,
0.00016895939188543707,
0.00017325379303656518,
0.0000031636436688131653
]
|
{
"id": 5,
"code_window": [
"\n",
" return (\n",
" <Page navModel={navModel}>\n",
" <Page.Contents isLoading={isLoading}>\n",
" {user && (\n",
" <>\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" <Page navId=\"global-users\" pageNav={pageNav} subTitle=\"Manage settings for an individual user.\">\n"
],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 111
} | import { Props } from '@storybook/addon-docs/blocks';
import { Tooltip } from './Tooltip';
# Tooltip
## Theme
There are currently themes available for the Tooltip.
- Info
- Error
- Info-alt (alternative)
### Info
This is the default theme, usually used in forms to show more information.
### Error
Tooltip with a red background.
### Info alternative
We added this to be able to add a `<JSONFormatter />` in the tooltip.
<Props of={Tooltip} />
| packages/grafana-ui/src/components/Tooltip/Tooltip.mdx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017753374413587153,
0.00017168762860819697,
0.00016858844901435077,
0.00016894069267436862,
0.000004136328243475873
]
|
{
"id": 6,
"code_window": [
" }\n",
"}\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" user: state.userAdmin.user,\n",
" sessions: state.userAdmin.sessions,\n",
" orgs: state.userAdmin.orgs,\n",
" ldapSyncInfo: state.ldap.syncInfo,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 155
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9991297125816345,
0.15538924932479858,
0.00016479527403134853,
0.0007932557491585612,
0.3549480438232422
]
|
{
"id": 6,
"code_window": [
" }\n",
"}\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" user: state.userAdmin.user,\n",
" sessions: state.userAdmin.sessions,\n",
" orgs: state.userAdmin.orgs,\n",
" ldapSyncInfo: state.ldap.syncInfo,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 155
} | #!/usr/bin/env bash
# Run this if you need to recreate the debian repository for some reason
# Setup environment
cp scripts/build/update_repo/aptly.conf /etc/aptly.conf
mkdir -p /deb-repo/db \
/deb-repo/repo \
/deb-repo/tmp
aptly repo create -distribution=stable -component=main grafana
aptly repo create -distribution=beta -component=main beta
aptly publish repo -architectures=amd64,i386,arm64,armhf grafana filesystem:repo:grafana
aptly publish repo -architectures=amd64,i386,arm64,armhf beta filesystem:repo:grafana
| scripts/build/update_repo/init-deb-repo.sh | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017456014757044613,
0.00017395042232237756,
0.00017334071162622422,
0.00017395042232237756,
6.097179721109569e-7
]
|
{
"id": 6,
"code_window": [
" }\n",
"}\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" user: state.userAdmin.user,\n",
" sessions: state.userAdmin.sessions,\n",
" orgs: state.userAdmin.orgs,\n",
" ldapSyncInfo: state.ldap.syncInfo,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 155
} | ---
aliases:
- /docs/grafana/latest/shared/test/
title: Shared Content
---
Intro text
- test bullet 1
- test bullet 2
| docs/sources/shared/test.md | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017733359709382057,
0.00017399205535184592,
0.00017065051360987127,
0.00017399205535184592,
0.000003341541741974652
]
|
{
"id": 6,
"code_window": [
" }\n",
"}\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" user: state.userAdmin.user,\n",
" sessions: state.userAdmin.sessions,\n",
" orgs: state.userAdmin.orgs,\n",
" ldapSyncInfo: state.ldap.syncInfo,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 155
} | import React, { SyntheticEvent, useState } from 'react';
import {
DataSourcePluginOptionsEditorProps,
onUpdateDatasourceJsonDataOption,
onUpdateDatasourceSecureJsonDataOption,
SelectableValue,
updateDatasourcePluginJsonDataOption,
updateDatasourcePluginResetOption,
} from '@grafana/data';
import { Alert, InlineSwitch, FieldSet, InlineField, InlineFieldRow, Input, Select, SecretInput } from '@grafana/ui';
import { ConnectionLimits } from 'app/features/plugins/sql/components/configuration/ConnectionLimits';
import { TLSSecretsConfig } from 'app/features/plugins/sql/components/configuration/TLSSecretsConfig';
import { PostgresOptions, PostgresTLSMethods, PostgresTLSModes, SecureJsonData } from '../types';
import { useAutoDetectFeatures } from './useAutoDetectFeatures';
export const postgresVersions: Array<SelectableValue<number>> = [
{ label: '9.0', value: 900 },
{ label: '9.1', value: 901 },
{ label: '9.2', value: 902 },
{ label: '9.3', value: 903 },
{ label: '9.4', value: 904 },
{ label: '9.5', value: 905 },
{ label: '9.6', value: 906 },
{ label: '10', value: 1000 },
{ label: '11', value: 1100 },
{ label: '12', value: 1200 },
{ label: '13', value: 1300 },
{ label: '14', value: 1400 },
{ label: '15', value: 1500 },
];
export const PostgresConfigEditor = (props: DataSourcePluginOptionsEditorProps<PostgresOptions, SecureJsonData>) => {
const [versionOptions, setVersionOptions] = useState(postgresVersions);
useAutoDetectFeatures({ props, setVersionOptions });
const { options, onOptionsChange } = props;
const jsonData = options.jsonData;
const onResetPassword = () => {
updateDatasourcePluginResetOption(props, 'password');
};
const tlsModes: Array<SelectableValue<PostgresTLSModes>> = [
{ value: PostgresTLSModes.disable, label: 'disable' },
{ value: PostgresTLSModes.require, label: 'require' },
{ value: PostgresTLSModes.verifyCA, label: 'verify-ca' },
{ value: PostgresTLSModes.verifyFull, label: 'verify-full' },
];
const tlsMethods: Array<SelectableValue<PostgresTLSMethods>> = [
{ value: PostgresTLSMethods.filePath, label: 'File system path' },
{ value: PostgresTLSMethods.fileContent, label: 'Certificate content' },
];
const onJSONDataOptionSelected = (property: keyof PostgresOptions) => {
return (value: SelectableValue) => {
updateDatasourcePluginJsonDataOption(props, property, value.value);
};
};
const onTimeScaleDBChanged = (event: SyntheticEvent<HTMLInputElement>) => {
updateDatasourcePluginJsonDataOption(props, 'timescaledb', event.currentTarget.checked);
};
const onDSOptionChanged = (property: keyof PostgresOptions) => {
return (event: SyntheticEvent<HTMLInputElement>) => {
onOptionsChange({ ...options, ...{ [property]: event.currentTarget.value } });
};
};
const labelWidthSSLDetails = 25;
const labelWidthConnection = 20;
const labelWidthShort = 20;
return (
<>
<FieldSet label="PostgreSQL Connection" width={400}>
<InlineField labelWidth={labelWidthConnection} label="Host">
<Input
width={40}
name="host"
type="text"
value={options.url || ''}
placeholder="localhost:5432"
onChange={onDSOptionChanged('url')}
></Input>
</InlineField>
<InlineField labelWidth={labelWidthConnection} label="Database">
<Input
width={40}
name="database"
value={options.database || ''}
placeholder="database name"
onChange={onDSOptionChanged('database')}
></Input>
</InlineField>
<InlineFieldRow>
<InlineField labelWidth={labelWidthConnection} label="User">
<Input value={options.user || ''} placeholder="user" onChange={onDSOptionChanged('user')}></Input>
</InlineField>
<InlineField label="Password">
<SecretInput
placeholder="Password"
isConfigured={options.secureJsonFields?.password}
onReset={onResetPassword}
onBlur={onUpdateDatasourceSecureJsonDataOption(props, 'password')}
></SecretInput>
</InlineField>
</InlineFieldRow>
<InlineField
labelWidth={labelWidthConnection}
label="TLS/SSL Mode"
htmlFor="tlsMode"
tooltip="This option determines whether or with what priority a secure TLS/SSL TCP/IP connection will be negotiated with the server."
>
<Select
options={tlsModes}
inputId="tlsMode"
value={jsonData.sslmode || PostgresTLSModes.verifyFull}
onChange={onJSONDataOptionSelected('sslmode')}
></Select>
</InlineField>
{options.jsonData.sslmode !== PostgresTLSModes.disable ? (
<InlineField
labelWidth={labelWidthConnection}
label="TLS/SSL Method"
htmlFor="tlsMethod"
tooltip={
<span>
This option determines how TLS/SSL certifications are configured. Selecting <i>File system path</i> will
allow you to configure certificates by specifying paths to existing certificates on the local file
system where Grafana is running. Be sure that the file is readable by the user executing the Grafana
process.
<br />
<br />
Selecting <i>Certificate content</i> will allow you to configure certificates by specifying its content.
The content will be stored encrypted in Grafana's database. When connecting to the database the
certificates will be written as files to Grafana's configured data path on the local file system.
</span>
}
>
<Select
options={tlsMethods}
inputId="tlsMethod"
value={jsonData.tlsConfigurationMethod || PostgresTLSMethods.filePath}
onChange={onJSONDataOptionSelected('tlsConfigurationMethod')}
></Select>
</InlineField>
) : null}
</FieldSet>
{options.jsonData.sslmode !== 'disable' ? (
<FieldSet label="TLS/SSL Auth Details">
{options.jsonData.tlsConfigurationMethod === PostgresTLSMethods.fileContent ? (
<TLSSecretsConfig editorProps={props} labelWidth={labelWidthSSLDetails}></TLSSecretsConfig>
) : (
<>
<InlineField
tooltip={
<span>
If the selected TLS/SSL mode requires a server root certificate, provide the path to the file here.
</span>
}
labelWidth={labelWidthSSLDetails}
label="TLS/SSL Root Certificate"
>
<Input
value={jsonData.sslRootCertFile || ''}
onChange={onUpdateDatasourceJsonDataOption(props, 'sslRootCertFile')}
placeholder="TLS/SSL root cert file"
></Input>
</InlineField>
<InlineField
tooltip={
<span>
To authenticate with an TLS/SSL client certificate, provide the path to the file here. Be sure that
the file is readable by the user executing the grafana process.
</span>
}
labelWidth={labelWidthSSLDetails}
label="TLS/SSL Client Certificate"
>
<Input
value={jsonData.sslCertFile || ''}
onChange={onUpdateDatasourceJsonDataOption(props, 'sslCertFile')}
placeholder="TLS/SSL client cert file"
></Input>
</InlineField>
<InlineField
tooltip={
<span>
To authenticate with a client TLS/SSL certificate, provide the path to the corresponding key file
here. Be sure that the file is <i>only</i> readable by the user executing the grafana process.
</span>
}
labelWidth={labelWidthSSLDetails}
label="TLS/SSL Client Key"
>
<Input
value={jsonData.sslKeyFile || ''}
onChange={onUpdateDatasourceJsonDataOption(props, 'sslKeyFile')}
placeholder="TLS/SSL client key file"
></Input>
</InlineField>
</>
)}
</FieldSet>
) : null}
<ConnectionLimits
labelWidth={labelWidthShort}
jsonData={jsonData}
onPropertyChanged={(property, value) => {
updateDatasourcePluginJsonDataOption(props, property, value);
}}
></ConnectionLimits>
<FieldSet label="PostgreSQL details">
<InlineField
tooltip="This option controls what functions are available in the PostgreSQL query builder"
labelWidth={labelWidthShort}
htmlFor="postgresVersion"
label="Version"
>
<Select
value={jsonData.postgresVersion || 903}
inputId="postgresVersion"
onChange={onJSONDataOptionSelected('postgresVersion')}
options={versionOptions}
></Select>
</InlineField>
<InlineField
tooltip={
<span>
TimescaleDB is a time-series database built as a PostgreSQL extension. If enabled, Grafana will use
<code>time_bucket</code> in the <code>$__timeGroup</code> macro and display TimescaleDB specific aggregate
functions in the query builder.
</span>
}
labelWidth={labelWidthShort}
label="TimescaleDB"
htmlFor="timescaledb"
>
<InlineSwitch
id="timescaledb"
value={jsonData.timescaledb || false}
onChange={onTimeScaleDBChanged}
></InlineSwitch>
</InlineField>
<InlineField
tooltip={
<span>
A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example
<code>1m</code> if your data is written every minute.
</span>
}
labelWidth={labelWidthShort}
label="Min time interval"
>
<Input
placeholder="1m"
value={jsonData.timeInterval || ''}
onChange={onUpdateDatasourceJsonDataOption(props, 'timeInterval')}
></Input>
</InlineField>
</FieldSet>
<Alert title="User Permission" severity="info">
The database user should only be granted SELECT permissions on the specified database & tables you want to
query. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example,
statements like <code>DELETE FROM user;</code> and <code>DROP TABLE user;</code> would be executed. To protect
against this we <strong>Highly</strong> recommend you create a specific PostgreSQL user with restricted
permissions.
</Alert>
</>
);
};
| public/app/plugins/datasource/postgres/configuration/ConfigurationEditor.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0003008164349012077,
0.0001759679871611297,
0.00016702934226486832,
0.00017143743752967566,
0.00002379277066211216
]
|
{
"id": 7,
"code_window": [
"import { contextSrv } from 'app/core/core';\n",
"\n",
"import PageLoader from '../../core/components/PageLoader/PageLoader';\n",
"import { getNavModel } from '../../core/selectors/navModel';\n",
"import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';\n",
"\n",
"import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 20
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.005983993876725435,
0.0006857542903162539,
0.000165039804414846,
0.00017423255485482514,
0.0013706166064366698
]
|
{
"id": 7,
"code_window": [
"import { contextSrv } from 'app/core/core';\n",
"\n",
"import PageLoader from '../../core/components/PageLoader/PageLoader';\n",
"import { getNavModel } from '../../core/selectors/navModel';\n",
"import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';\n",
"\n",
"import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 20
} | <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 80.73 58.39"><defs><style>.cls-1{fill:#84aff1;}.cls-2{fill:#3865ab;}.cls-3{fill:url(#linear-gradient);}</style><linearGradient id="linear-gradient" x1="54.11" y1="33.93" x2="72.49" y2="33.93" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f2cc0c"/><stop offset="1" stop-color="#ff9830"/></linearGradient></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M27.14,48.88l7-13.94v-.11H26v-3.4H38.54v3.43l-7.06,14Z"/><path class="cls-1" d="M47.2,31.13a8.09,8.09,0,0,1,2.74.47,6.1,6.1,0,0,1,2.32,1.48,7,7,0,0,1,1.61,2.67,12,12,0,0,1,.59,4,12.44,12.44,0,0,1-.91,5A7.32,7.32,0,0,1,51,48a6.77,6.77,0,0,1-3.87,1.11,7,7,0,0,1-3.25-.71,5.91,5.91,0,0,1-2.24-1.92,5.79,5.79,0,0,1-1-2.71h4.15a2.07,2.07,0,0,0,.83,1.31,2.77,2.77,0,0,0,3.9-1,7.76,7.76,0,0,0,.79-3.78h-.1a3.94,3.94,0,0,1-1.75,1.84,5.41,5.41,0,0,1-2.68.67A5.32,5.32,0,0,1,43,42.15a5,5,0,0,1-1.88-2,5.89,5.89,0,0,1-.68-2.88,6,6,0,0,1,.85-3.21,5.85,5.85,0,0,1,2.37-2.17A7.45,7.45,0,0,1,47.2,31.13Zm0,3.24a2.59,2.59,0,0,0-1.94.8,3,3,0,0,0,0,4,2.73,2.73,0,0,0,3.86,0,2.79,2.79,0,0,0,.78-2,2.82,2.82,0,0,0-.77-2A2.56,2.56,0,0,0,47.23,34.37Z"/><path class="cls-1" d="M30.08,18.55a24.24,24.24,0,0,1,8.28-2.22v-8a31.86,31.86,0,0,0-12.29,3.3Z"/><path class="cls-2" d="M42.36,8.31v8a24.23,24.23,0,0,1,8.29,2.22l4-6.94A31.86,31.86,0,0,0,42.36,8.31Z"/><path class="cls-2" d="M7.52,56a36.13,36.13,0,0,1-3.44-18A36.37,36.37,0,1,1,73.21,56a1,1,0,0,0,.39,1.3l1.75,1a1,1,0,0,0,1.4-.42A40.37,40.37,0,1,0,4,57.83a1,1,0,0,0,1.4.42l1.75-1A1,1,0,0,0,7.52,56Z"/><path class="cls-2" d="M17.77,51.1a1,1,0,0,0,.41-1.27,24.08,24.08,0,0,1,8.44-29.27l-4-6.94A32.06,32.06,0,0,0,11.14,53.68a1,1,0,0,0,1.41.43Z"/><path class="cls-3" d="M64.49,40.37a24.09,24.09,0,0,1-1.94,9.46A1,1,0,0,0,63,51.1l5.22,3a1,1,0,0,0,1.41-.43A32.06,32.06,0,0,0,58.12,13.62l-4,6.94A24.12,24.12,0,0,1,64.49,40.37Z"/></g></g></svg> | public/app/plugins/panel/gauge/img/icon_gauge.svg | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017016434867400676,
0.00017016434867400676,
0.00017016434867400676,
0.00017016434867400676,
0
]
|
{
"id": 7,
"code_window": [
"import { contextSrv } from 'app/core/core';\n",
"\n",
"import PageLoader from '../../core/components/PageLoader/PageLoader';\n",
"import { getNavModel } from '../../core/selectors/navModel';\n",
"import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';\n",
"\n",
"import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 20
} | ---
aliases:
- /docs/grafana/latest/datasources/influxdb/
- /docs/grafana/latest/features/datasources/influxdb/
description: Guide for using InfluxDB in Grafana
keywords:
- grafana
- influxdb
- guide
- flux
title: InfluxDB data source
weight: 700
---
# InfluxDB data source
{{< docs/shared "influxdb/intro.md" >}}
This topic explains options, variables, querying, and other options specific to this data source. Refer to [Add a data source]({{< relref "../add-a-data-source/" >}}) for instructions on how to add a data source to Grafana. Only users with the organization admin role can add data sources.
## Data source options
To access data source settings, hover your mouse over the **Configuration** (gear) icon, then click **Data sources**, and then click the data source.
InfluxDB data source options differ depending on which [query language](#query-languages) you select: InfluxQL or Flux.
> **Note:** Though not required, it's a good practice to append the language choice to the data source name. For example:
- InfluxDB-InfluxQL
- InfluxDB-Flux
### InfluxQL (classic InfluxDB query)
These options apply if you are using the InfluxQL query language. If you are using Flux, refer to [Flux support in Grafana]({{< relref "influxdb-flux/" >}}).
| Name | Description |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Name` | The data source name. This is how you refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. |
| `Default` | Default data source means that it will be pre-selected for new panels. |
| `URL` | The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB API port is by default 8086. |
| `Access` | Direct browser access has been deprecated. Use “Server (default)” or the datasource won’t function. |
| `Allowed cookies` | Cookies that will be forwarded to the data source. All other cookies will be deleted. |
| `Database` | The ID of the bucket you want to query from, copied from the [Buckets page](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) of the InfluxDB UI. |
| `User` | The username you use to sign into InfluxDB. |
| `Password` | The token you use to query the bucket above, copied from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI. |
| `HTTP mode` | How to query the database (`GET` or `POST` HTTP verb). The `POST` verb allows heavy queries that would return an error using the `GET` verb. Default is `GET`. |
| `Min time interval` | (Optional) Refer to [Min time interval]({{< relref "#min-time-interval" >}}). |
| `Max series` | (Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000. |
### Flux
For information on data source settings and using Flux in Grafana, refer to [Flux support in Grafana]({{< relref "influxdb-flux/" >}}).
#### Min time interval
A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example `1m` if your data is written every minute.
This option can also be overridden/configured in a dashboard panel under data source options. It's important to note that this value _must_ be formatted as a number followed by a valid time identifier, e.g. `1m` (1 minute) or `30s` (30 seconds). The following time identifiers are supported:
| Identifier | Description |
| ---------- | ----------- |
| `y` | year |
| `M` | month |
| `w` | week |
| `d` | day |
| `h` | hour |
| `m` | minute |
| `s` | second |
| `ms` | millisecond |
## Query languages
You can query InfluxDB using InfluxQL or Flux:
- [InfluxQL](https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/) is a SQL-like language for querying InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users. InfluxQL is available in InfluxDB 1.0 onwards.
- [Flux](https://docs.influxdata.com/influxdb/v2.0/query-data/get-started/) provides significantly broader functionality than InfluxQL, supporting not only queries, but built-in functions for data shaping, string manipulation, joining to non-InfluxDB data sources and more, but also processing time-series data. It’s more similar to JavaScript with a functional style.
To help you choose the best language for your needs, here’s a comparison of [Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/), and [why InfluxData created Flux](https://www.influxdata.com/blog/why-were-building-flux-a-new-data-scripting-and-query-language/).
## InfluxQL query editor
Enter edit mode by clicking the panel title and clicking **Edit**. The editor allows you to select metrics and tags.

### Filter data (WHERE)
To add a tag filter, click the plus icon to the right of the `WHERE` condition. You can remove tag filters by clicking on the tag key and then selecting `--remove tag filter--`.
**Regex matching**
You can type in regex patterns for metric names or tag filter values. Be sure to wrap the regex pattern in forward slashes (`/`). Grafana automatically adjusts the filter tag condition to use the InfluxDB regex match condition operator (`=~`).
### Field and Aggregation functions
In the `SELECT` row you can specify what fields and functions you want to use. If you have a
group by time you need an aggregation function. Some functions like derivative require an aggregation function. The editor tries to simplify and unify this part of the query. For example:

The above generates the following InfluxDB `SELECT` clause:
```sql
SELECT derivative(mean("value"), 10s) /10 AS "REQ/s" FROM ....
```
#### Select multiple fields
Use the plus button and select Field > field to add another SELECT clause. You can also
specify an asterix `*` to select all fields.
### Group By
To group by a tag, click the plus icon at the end of the GROUP BY row. Pick a tag from the dropdown that appears.
You can remove the "Group By" by clicking on the `tag` and then click on the x icon.
### Text Editor Mode (RAW)
You can switch to raw query mode by clicking hamburger icon and then `Switch editor mode`.
> If you use Raw Query be sure your query at minimum have `WHERE $timeFilter`.
> Also, always have a group by time and an aggregation function, otherwise InfluxDB can easily return hundreds of thousands of data points that will hang the browser.
### Alias patterns
- $m = replaced with measurement name
- $measurement = replaced with measurement name
- $1 - $9 = replaced with part of measurement name (if you separate your measurement name with dots)
- $col = replaced with column name
- $tag_exampletag = replaced with the value of the `exampletag` tag. The syntax is `$tag*yourTagName`(must start with`$tag*`). To use your tag as an alias in the ALIAS BY field then the tag must be used to group by in the query.
- You can also use [[tag_hostname]] pattern replacement syntax. For example, in the ALIAS BY field using this text `Host: [[tag_hostname]]` would substitute in the `hostname` tag value for each legend value and an example legend value would be: `Host: server1`.
## Querying logs
Querying and displaying log data from InfluxDB is available in [Explore]({{< relref "../../explore/" >}}), and in the [logs panel]({{< relref "../../visualizations/logs-panel/" >}}) in dashboards.
Select the InfluxDB data source, and then enter a query to display your logs.
### Log queries
The Logs Explorer (the `Measurements/Fields` button) next to the query field shows a list of measurements and fields. Choose the desired measurement that contains your log data and then choose which field Explore should use to display the log message.
Once the result is returned, the log panel shows a list of log rows and a bar chart where the x-axis shows the time and the y-axis shows the frequency/count.
### Filter search
To add a filter, click the plus icon to the right of the `Measurements/Fields` button or a condition. You can remove tag filters by clicking on the first select and choosing `--remove filter--`.
## Annotations
[Annotations]({{< relref "../../dashboards/annotations/" >}}) allows you to overlay rich event information on top of graphs. Add annotation queries using the Annotations view in the Dashboard menu.
An example query:
```SQL
SELECT title, description from events WHERE $timeFilter ORDER BY time ASC
```
For InfluxDB, you need to enter a query like the one in the example above. The `where $timeFilter` component is required. If you only select one column, then you do not need to enter anything in the column mapping fields. The **Tags** field can be a comma-separated string.
| docs/sources/datasources/influxdb/_index.md | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017624732572585344,
0.00016816618153825402,
0.0001597036316525191,
0.0001675229286774993,
0.000004500022896536393
]
|
{
"id": 7,
"code_window": [
"import { contextSrv } from 'app/core/core';\n",
"\n",
"import PageLoader from '../../core/components/PageLoader/PageLoader';\n",
"import { getNavModel } from '../../core/selectors/navModel';\n",
"import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';\n",
"\n",
"import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 20
} | import React from 'react';
import { gte, lt, valid } from 'semver';
import { DataSourceSettings, SelectableValue } from '@grafana/data';
import { FieldSet, InlineField, Input, Select, InlineSwitch } from '@grafana/ui';
import { ElasticsearchOptions, Interval } from '../types';
import { isTruthy } from './utils';
const indexPatternTypes: Array<SelectableValue<'none' | Interval>> = [
{ label: 'No pattern', value: 'none' },
{ label: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH' },
{ label: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD' },
{ label: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW' },
{ label: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM' },
{ label: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY' },
];
const esVersions: SelectableValue[] = [
{ label: '7.10+', value: '7.10.0' },
{
label: '8.0+',
value: '8.0.0',
description: 'support for Elasticsearch 8 is currently experimental',
},
];
type Props = {
value: DataSourceSettings<ElasticsearchOptions>;
onChange: (value: DataSourceSettings<ElasticsearchOptions>) => void;
};
export const ElasticDetails = ({ value, onChange }: Props) => {
const currentVersion = esVersions.find((version) => version.value === value.jsonData.esVersion);
const customOption =
!currentVersion && valid(value.jsonData.esVersion)
? {
label: value.jsonData.esVersion,
value: value.jsonData.esVersion,
}
: undefined;
return (
<>
<FieldSet label="Elasticsearch details">
<InlineField label="Index name" labelWidth={26}>
<Input
id="es_config_indexName"
value={value.database || ''}
onChange={changeHandler('database', value, onChange)}
width={24}
placeholder="es-index-name"
required
/>
</InlineField>
<InlineField label="Pattern" labelWidth={26}>
<Select
inputId="es_config_indexPattern"
value={indexPatternTypes.find(
(pattern) => pattern.value === (value.jsonData.interval === undefined ? 'none' : value.jsonData.interval)
)}
options={indexPatternTypes}
onChange={intervalHandler(value, onChange)}
width={24}
/>
</InlineField>
<InlineField label="Time field name" labelWidth={26}>
<Input
id="es_config_timeField"
value={value.jsonData.timeField || ''}
onChange={jsonDataChangeHandler('timeField', value, onChange)}
width={24}
placeholder="@timestamp"
required
/>
</InlineField>
<InlineField label="ElasticSearch version" labelWidth={26}>
<Select
inputId="es_config_version"
options={[customOption, ...esVersions].filter(isTruthy)}
onChange={(option) => {
const maxConcurrentShardRequests = getMaxConcurrenShardRequestOrDefault(
value.jsonData.maxConcurrentShardRequests,
option.value!
);
onChange({
...value,
jsonData: {
...value.jsonData,
esVersion: option.value!,
maxConcurrentShardRequests,
},
});
}}
value={currentVersion || customOption}
width={24}
/>
</InlineField>
{gte(value.jsonData.esVersion, '5.6.0') && (
<InlineField label="Max concurrent Shard Requests" labelWidth={26}>
<Input
id="es_config_shardRequests"
value={value.jsonData.maxConcurrentShardRequests || ''}
onChange={jsonDataChangeHandler('maxConcurrentShardRequests', value, onChange)}
width={24}
/>
</InlineField>
)}
<InlineField
label="Min time interval"
labelWidth={26}
tooltip={
<>
A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example{' '}
<code>1m</code> if your data is written every minute.
</>
}
error="Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s"
invalid={!!value.jsonData.timeInterval && !/^\d+(ms|[Mwdhmsy])$/.test(value.jsonData.timeInterval)}
>
<Input
id="es_config_minTimeInterval"
value={value.jsonData.timeInterval || ''}
onChange={jsonDataChangeHandler('timeInterval', value, onChange)}
width={24}
placeholder="10s"
/>
</InlineField>
<InlineField label="X-Pack enabled" labelWidth={26}>
<InlineSwitch
id="es_config_xpackEnabled"
checked={value.jsonData.xpack || false}
onChange={jsonDataSwitchChangeHandler('xpack', value, onChange)}
/>
</InlineField>
{gte(value.jsonData.esVersion, '6.6.0') && value.jsonData.xpack && (
<InlineField label="Include Frozen Indices" labelWidth={26}>
<InlineSwitch
id="es_config_frozenIndices"
checked={value.jsonData.includeFrozen ?? false}
onChange={jsonDataSwitchChangeHandler('includeFrozen', value, onChange)}
/>
</InlineField>
)}
</FieldSet>
</>
);
};
// TODO: Use change handlers from @grafana/data
const changeHandler =
(key: keyof DataSourceSettings<ElasticsearchOptions>, value: Props['value'], onChange: Props['onChange']) =>
(event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {
onChange({
...value,
[key]: event.currentTarget.value,
});
};
// TODO: Use change handlers from @grafana/data
const jsonDataChangeHandler =
(key: keyof ElasticsearchOptions, value: Props['value'], onChange: Props['onChange']) =>
(event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {
onChange({
...value,
jsonData: {
...value.jsonData,
[key]: event.currentTarget.value,
},
});
};
const jsonDataSwitchChangeHandler =
(key: keyof ElasticsearchOptions, value: Props['value'], onChange: Props['onChange']) =>
(event: React.SyntheticEvent<HTMLInputElement>) => {
onChange({
...value,
jsonData: {
...value.jsonData,
[key]: event.currentTarget.checked,
},
});
};
const intervalHandler =
(value: Props['value'], onChange: Props['onChange']) => (option: SelectableValue<Interval | 'none'>) => {
const { database } = value;
// If option value is undefined it will send its label instead so we have to convert made up value to undefined here.
const newInterval = option.value === 'none' ? undefined : option.value;
if (!database || database.length === 0 || database.startsWith('[logstash-]')) {
let newDatabase = '';
if (newInterval !== undefined) {
const pattern = indexPatternTypes.find((pattern) => pattern.value === newInterval);
if (pattern) {
newDatabase = pattern.example ?? '';
}
}
onChange({
...value,
database: newDatabase,
jsonData: {
...value.jsonData,
interval: newInterval,
},
});
} else {
onChange({
...value,
jsonData: {
...value.jsonData,
interval: newInterval,
},
});
}
};
function getMaxConcurrenShardRequestOrDefault(maxConcurrentShardRequests: number | undefined, version: string): number {
if (maxConcurrentShardRequests === 5 && lt(version, '7.0.0')) {
return 256;
}
if (maxConcurrentShardRequests === 256 && gte(version, '7.0.0')) {
return 5;
}
return maxConcurrentShardRequests || defaultMaxConcurrentShardRequests(version);
}
export function defaultMaxConcurrentShardRequests(version: string) {
return gte(version, '7.0.0') ? 5 : 256;
}
| public/app/plugins/datasource/elasticsearch/configuration/ElasticDetails.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017993137589655817,
0.00017416113405488431,
0.00016615503409411758,
0.00017460942035540938,
0.000003376585254954989
]
|
{
"id": 8,
"code_window": [
"};\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" users: state.userListAdmin.users,\n",
" query: state.userListAdmin.query,\n",
" showPaging: state.userListAdmin.showPaging,\n",
" totalPages: state.userListAdmin.totalPages,\n",
" page: state.userListAdmin.page,\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 43
} | import { css, cx } from '@emotion/css';
import React, { ComponentType, useEffect, useMemo, memo } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { GrafanaTheme2 } from '@grafana/data';
import {
Icon,
IconName,
LinkButton,
Pagination,
RadioButtonGroup,
Tooltip,
useStyles2,
FilterInput,
} from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
import { contextSrv } from 'app/core/core';
import PageLoader from '../../core/components/PageLoader/PageLoader';
import { getNavModel } from '../../core/selectors/navModel';
import { AccessControlAction, StoreState, Unit, UserDTO, UserFilter } from '../../types';
import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actions';
export interface FilterProps {
filters: UserFilter[];
onChange: (filter: any) => void;
className?: string;
}
const extraFilters: Array<ComponentType<FilterProps>> = [];
export const addExtraFilters = (filter: ComponentType<FilterProps>) => {
extraFilters.push(filter);
};
const mapDispatchToProps = {
fetchUsers,
changeQuery,
changePage,
changeFilter,
};
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
users: state.userListAdmin.users,
query: state.userListAdmin.query,
showPaging: state.userListAdmin.showPaging,
totalPages: state.userListAdmin.totalPages,
page: state.userListAdmin.page,
filters: state.userListAdmin.filters,
isLoading: state.userListAdmin.isLoading,
});
const connector = connect(mapStateToProps, mapDispatchToProps);
interface OwnProps {}
type Props = OwnProps & ConnectedProps<typeof connector>;
const UserListAdminPageUnConnected: React.FC<Props> = ({
fetchUsers,
navModel,
query,
changeQuery,
users,
showPaging,
totalPages,
page,
changePage,
changeFilter,
filters,
isLoading,
}) => {
const styles = useStyles2(getStyles);
useEffect(() => {
fetchUsers();
}, [fetchUsers]);
const showLicensedRole = useMemo(() => users.some((user) => user.licensedRole), [users]);
return (
<Page navModel={navModel}>
<Page.Contents>
<div className="page-action-bar">
<div className="gf-form gf-form--grow">
<FilterInput
placeholder="Search user by login, email, or name."
autoFocus={true}
value={query}
onChange={changeQuery}
/>
<RadioButtonGroup
options={[
{ label: 'All users', value: false },
{ label: 'Active last 30 days', value: true },
]}
onChange={(value) => changeFilter({ name: 'activeLast30Days', value })}
value={filters.find((f) => f.name === 'activeLast30Days')?.value}
className={styles.filter}
/>
{extraFilters.map((FilterComponent, index) => (
<FilterComponent key={index} filters={filters} onChange={changeFilter} className={styles.filter} />
))}
</div>
{contextSrv.hasPermission(AccessControlAction.UsersCreate) && (
<LinkButton href="admin/users/create" variant="primary">
New user
</LinkButton>
)}
</div>
{isLoading ? (
<PageLoader />
) : (
<>
<div className={cx(styles.table, 'admin-list-table')}>
<table className="filter-table form-inline filter-table--hover">
<thead>
<tr>
<th></th>
<th>Login</th>
<th>Email</th>
<th>Name</th>
<th>Belongs to</th>
{showLicensedRole && (
<th>
Licensed role{' '}
<Tooltip
placement="top"
content={
<>
Licensed role is based on a user's Org role (i.e. Viewer, Editor, Admin) and their
dashboard/folder permissions.{' '}
<a
className={styles.link}
target="_blank"
rel="noreferrer noopener"
href={
'https://grafana.com/docs/grafana/next/enterprise/license/license-restrictions/#active-users-limit'
}
>
Learn more
</a>
</>
}
>
<Icon name="question-circle" />
</Tooltip>
</th>
)}
<th>
Last active
<Tooltip placement="top" content="Time since user was seen using Grafana">
<Icon name="question-circle" />
</Tooltip>
</th>
<th style={{ width: '1%' }}></th>
</tr>
</thead>
<tbody>
{users.map((user) => (
<UserListItem user={user} showLicensedRole={showLicensedRole} key={user.id} />
))}
</tbody>
</table>
</div>
{showPaging && <Pagination numberOfPages={totalPages} currentPage={page} onNavigate={changePage} />}
</>
)}
</Page.Contents>
</Page>
);
};
const getUsersAriaLabel = (name: string) => {
return `Edit user's ${name} details`;
};
type UserListItemProps = {
user: UserDTO;
showLicensedRole: boolean;
};
const UserListItem = memo(({ user, showLicensedRole }: UserListItemProps) => {
const styles = useStyles2(getStyles);
const editUrl = `admin/users/edit/${user.id}`;
return (
<tr key={user.id}>
<td className="width-4 text-center link-td">
<a href={editUrl} aria-label={`Edit user's ${user.name} details`}>
<img className="filter-table__avatar" src={user.avatarUrl} alt={`Avatar for user ${user.name}`} />
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.login} aria-label={getUsersAriaLabel(user.name)}>
{user.login}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.email} aria-label={getUsersAriaLabel(user.name)}>
{user.email}
</a>
</td>
<td className="link-td max-width-10">
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.name}
</a>
</td>
<td
className={styles.row}
title={
user.orgs?.length
? `The user is a member of the following organizations: ${user.orgs.map((org) => org.name).join(',')}`
: undefined
}
>
<OrgUnits units={user.orgs} icon={'building'} />
{user.isAdmin && (
<a href={editUrl} aria-label={getUsersAriaLabel(user.name)}>
<Tooltip placement="top" content="Grafana Admin">
<Icon name="shield" />
</Tooltip>
</a>
)}
</td>
{showLicensedRole && (
<td className={cx('link-td', styles.iconRow)}>
<a className="ellipsis" href={editUrl} title={user.name} aria-label={getUsersAriaLabel(user.name)}>
{user.licensedRole === 'None' ? (
<span className={styles.disabled}>
Not assigned{' '}
<Tooltip placement="top" content="A licensed role will be assigned when this user signs in">
<Icon name="question-circle" />
</Tooltip>
</span>
) : (
user.licensedRole
)}
</a>
</td>
)}
<td className="link-td">
{user.lastSeenAtAge && (
<a
href={editUrl}
aria-label={`Last seen at ${user.lastSeenAtAge}. Follow to edit user's ${user.name} details.`}
>
{user.lastSeenAtAge === '10 years' ? <span className={styles.disabled}>Never</span> : user.lastSeenAtAge}
</a>
)}
</td>
<td className="text-right">
{Array.isArray(user.authLabels) && user.authLabels.length > 0 && (
<TagBadge label={user.authLabels[0]} removeIcon={false} count={0} />
)}
</td>
<td className="text-right">
{user.isDisabled && <span className="label label-tag label-tag--gray">Disabled</span>}
</td>
</tr>
);
});
UserListItem.displayName = 'UserListItem';
type OrgUnitProps = { units?: Unit[]; icon: IconName };
const OrgUnits = ({ units, icon }: OrgUnitProps) => {
const styles = useStyles2(getStyles);
if (!units?.length) {
return null;
}
return units.length > 1 ? (
<Tooltip
placement={'top'}
content={
<div className={styles.unitTooltip}>
{units?.map((unit) => (
<a
href={unit.url}
className={styles.link}
title={unit.name}
key={unit.name}
aria-label={`Edit ${unit.name}`}
>
{unit.name}
</a>
))}
</div>
}
>
<div className={styles.unitItem}>
<Icon name={icon} /> <span>{units.length}</span>
</div>
</Tooltip>
) : (
<a
href={units[0].url}
className={styles.unitItem}
title={units[0].name}
key={units[0].name}
aria-label={`Edit ${units[0].name}`}
>
<Icon name={icon} /> {units[0].name}
</a>
);
};
const getStyles = (theme: GrafanaTheme2) => {
return {
table: css`
margin-top: ${theme.spacing(3)};
`,
filter: css`
margin: 0 ${theme.spacing(1)};
`,
iconRow: css`
svg {
margin-left: ${theme.spacing(0.5)};
}
`,
row: css`
display: flex;
align-items: center;
height: 100% !important;
a {
padding: ${theme.spacing(0.5)} 0 !important;
}
`,
unitTooltip: css`
display: flex;
flex-direction: column;
`,
unitItem: css`
cursor: pointer;
padding: ${theme.spacing(0.5)} 0;
margin-right: ${theme.spacing(1)};
`,
disabled: css`
color: ${theme.colors.text.disabled};
`,
link: css`
color: inherit;
cursor: pointer;
text-decoration: underline;
`,
};
};
export default connector(UserListAdminPageUnConnected);
| public/app/features/admin/UserListAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.999251663684845,
0.06654956936836243,
0.00016442217747680843,
0.0001732556993374601,
0.23435793817043304
]
|
{
"id": 8,
"code_window": [
"};\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" users: state.userListAdmin.users,\n",
" query: state.userListAdmin.query,\n",
" showPaging: state.userListAdmin.showPaging,\n",
" totalPages: state.userListAdmin.totalPages,\n",
" page: state.userListAdmin.page,\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 43
} |
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 Grafana Labs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| packages/grafana-schema/LICENSE_APACHE2 | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017906073480844498,
0.0001768419169820845,
0.00017462423420511186,
0.0001769923692336306,
0.0000010468396567375748
]
|
{
"id": 8,
"code_window": [
"};\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" users: state.userListAdmin.users,\n",
" query: state.userListAdmin.query,\n",
" showPaging: state.userListAdmin.showPaging,\n",
" totalPages: state.userListAdmin.totalPages,\n",
" page: state.userListAdmin.page,\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 43
} | import { render, screen } from '@testing-library/react';
import React from 'react';
import { Provider } from 'react-redux';
import { createTheme } from '@grafana/data';
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
import { User } from 'app/core/services/context_srv';
import { configureStore } from 'app/store/configureStore';
import { OrgRole, Team, TeamMember } from '../../types';
import { Props, TeamPages } from './TeamPages';
import { getMockTeam } from './__mocks__/teamMocks';
jest.mock('app/core/components/Select/UserPicker', () => {
return { UserPicker: () => null };
});
jest.mock('app/core/services/context_srv', () => ({
contextSrv: {
accessControlEnabled: () => false,
hasPermissionInMetadata: () => false,
hasAccessInMetadata: () => true,
user: {},
},
}));
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
getBackendSrv: () => ({
get: jest.fn().mockResolvedValue([{ userId: 1, login: 'Test' }]),
}),
config: {
licenseInfo: {
enabledFeatures: { teamsync: true },
stateInfo: '',
licenseUrl: '',
},
featureToggles: { accesscontrol: false },
bootData: { navTree: [], user: {} },
buildInfo: {
edition: 'Open Source',
},
appSubUrl: '',
},
featureEnabled: () => true,
}));
// Mock connected child components instead of rendering them
jest.mock('./TeamSettings', () => {
//eslint-disable-next-line
return () => <div>Team settings</div>;
});
jest.mock('./TeamGroupSync', () => {
//eslint-disable-next-line
return () => <div>Team group sync</div>;
});
const setup = (propOverrides?: object) => {
const store = configureStore();
const props: Props = {
...getRouteComponentProps({
match: {
params: {
id: '1',
page: null,
},
} as any,
}),
pageNav: { text: 'Cool team ' },
teamId: 1,
loadTeam: jest.fn(),
loadTeamMembers: jest.fn(),
pageName: 'members',
team: {} as Team,
members: [] as TeamMember[],
editorsCanAdmin: false,
theme: createTheme(),
signedInUser: {
id: 1,
isGrafanaAdmin: false,
orgRole: OrgRole.Viewer,
} as User,
};
Object.assign(props, propOverrides);
render(
<Provider store={store}>
<TeamPages {...props} />
</Provider>
);
};
describe('Render', () => {
it('should render member page if team not empty', async () => {
setup({
team: getMockTeam(),
});
expect(await screen.findByRole('button', { name: 'Add member' })).toBeInTheDocument();
});
it('should render settings and preferences page', async () => {
setup({
team: getMockTeam(),
pageName: 'settings',
preferences: {
homeDashboardUID: 'home-dashboard',
theme: 'Default',
timezone: 'Default',
},
});
expect(await screen.findByText('Team settings')).toBeInTheDocument();
});
it('should render group sync page', async () => {
setup({
team: getMockTeam(),
pageName: 'groupsync',
});
expect(await screen.findByText('Team group sync')).toBeInTheDocument();
});
});
describe('when feature toggle editorsCanAdmin is turned on', () => {
it('should render settings page if user is team admin', async () => {
setup({
team: getMockTeam(),
pageName: 'settings',
preferences: {
homeDashboardUID: 'home-dashboard',
theme: 'Default',
timezone: 'Default',
},
editorsCanAdmin: true,
signedInUser: {
id: 1,
isGrafanaAdmin: false,
orgRole: OrgRole.Admin,
} as User,
});
expect(await screen.findByText('Team settings')).toBeInTheDocument();
});
});
| public/app/features/teams/TeamPages.test.tsx | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00034464168129488826,
0.00018285587430000305,
0.00016435053839813918,
0.0001713021338218823,
0.000043351326894480735
]
|
{
"id": 8,
"code_window": [
"};\n",
"\n",
"const mapStateToProps = (state: StoreState) => ({\n",
" navModel: getNavModel(state.navIndex, 'global-users'),\n",
" users: state.userListAdmin.users,\n",
" query: state.userListAdmin.query,\n",
" showPaging: state.userListAdmin.showPaging,\n",
" totalPages: state.userListAdmin.totalPages,\n",
" page: state.userListAdmin.page,\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 43
} | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PathElem legibility creates consumable JSON 1`] = `
Object {
"memberIdx": 1,
"memberOf": Object {
"focalIdx": 2,
"members": Array [
Object {
"memberIdx": 0,
"operation": "firstOperation",
"service": "firstService",
"visibilityIdx": 4,
},
Object {
"memberIdx": 1,
"operation": "beforeOperation",
"service": "beforeService",
"visibilityIdx": 2,
},
Object {
"memberIdx": 2,
"operation": "focalOperation",
"service": "focalService",
"visibilityIdx": 0,
},
Object {
"memberIdx": 3,
"operation": "afterOperation",
"service": "afterService",
"visibilityIdx": 1,
},
Object {
"memberIdx": 4,
"operation": "lastOperation",
"service": "lastService",
"visibilityIdx": 3,
},
],
},
"operation": "beforeOperation",
"service": "beforeService",
"visibilityIdx": 2,
}
`;
| packages/jaeger-ui-components/src/model/ddg/__snapshots__/PathElem.test.js.snap | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.00017598620615899563,
0.00017494670464657247,
0.00017416644550394267,
0.00017435071640647948,
8.233412245317595e-7
]
|
{
"id": 9,
"code_window": [
"\n",
"type Props = OwnProps & ConnectedProps<typeof connector>;\n",
"\n",
"const UserListAdminPageUnConnected: React.FC<Props> = ({\n",
" fetchUsers,\n",
" navModel,\n",
" query,\n",
" changeQuery,\n",
" users,\n",
" showPaging,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 61
} | import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
import { UserLdapSyncInfo } from './UserLdapSyncInfo';
import { UserOrgs } from './UserOrgs';
import { UserPermissions } from './UserPermissions';
import { UserProfile } from './UserProfile';
import { UserSessions } from './UserSessions';
import {
loadAdminUserPage,
revokeSession,
revokeAllSessions,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
syncLdapUser,
} from './state/actions';
interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
navModel: NavModel;
user?: UserDTO;
orgs: UserOrg[];
sessions: UserSession[];
ldapSyncInfo?: SyncInfo;
isLoading: boolean;
error?: UserAdminError;
}
export class UserAdminPage extends PureComponent<Props> {
async componentDidMount() {
const { match, loadAdminUserPage } = this.props;
loadAdminUserPage(parseInt(match.params.id, 10));
}
onUserUpdate = (user: UserDTO) => {
this.props.updateUser(user);
};
onPasswordChange = (password: string) => {
const { user, setUserPassword } = this.props;
user && setUserPassword(user.id, password);
};
onUserDelete = (userId: number) => {
this.props.deleteUser(userId);
};
onUserDisable = (userId: number) => {
this.props.disableUser(userId);
};
onUserEnable = (userId: number) => {
this.props.enableUser(userId);
};
onGrafanaAdminChange = (isGrafanaAdmin: boolean) => {
const { user, updateUserPermissions } = this.props;
user && updateUserPermissions(user.id, isGrafanaAdmin);
};
onOrgRemove = (orgId: number) => {
const { user, deleteOrgUser } = this.props;
user && deleteOrgUser(user.id, orgId);
};
onOrgRoleChange = (orgId: number, newRole: string) => {
const { user, updateOrgUserRole } = this.props;
user && updateOrgUserRole(user.id, orgId, newRole);
};
onOrgAdd = (orgId: number, role: string) => {
const { user, addOrgUser } = this.props;
user && addOrgUser(user, orgId, role);
};
onSessionRevoke = (tokenId: number) => {
const { user, revokeSession } = this.props;
user && revokeSession(tokenId, user.id);
};
onAllSessionsRevoke = () => {
const { user, revokeAllSessions } = this.props;
user && revokeAllSessions(user.id);
};
onUserSync = () => {
const { user, syncLdapUser } = this.props;
user && syncLdapUser(user.id);
};
render() {
const { navModel, user, orgs, sessions, ldapSyncInfo, isLoading } = this.props;
const isLDAPUser = user && user.isExternal && user.authLabels && user.authLabels.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
return (
<Page navModel={navModel}>
<Page.Contents isLoading={isLoading}>
{user && (
<>
<UserProfile
user={user}
onUserUpdate={this.onUserUpdate}
onUserDelete={this.onUserDelete}
onUserDisable={this.onUserDisable}
onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange}
/>
{isLDAPUser && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</>
)}
{orgs && (
<UserOrgs
user={user}
orgs={orgs}
isExternalUser={user?.isExternal}
onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd}
/>
)}
{sessions && canReadSessions && (
<UserSessions
sessions={sessions}
onSessionRevoke={this.onSessionRevoke}
onAllSessionsRevoke={this.onAllSessionsRevoke}
/>
)}
</Page.Contents>
</Page>
);
}
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'global-users'),
user: state.userAdmin.user,
sessions: state.userAdmin.sessions,
orgs: state.userAdmin.orgs,
ldapSyncInfo: state.ldap.syncInfo,
isLoading: state.userAdmin.isLoading,
error: state.userAdmin.error,
});
const mapDispatchToProps = {
loadAdminUserPage,
updateUser,
setUserPassword,
disableUser,
enableUser,
deleteUser,
updateUserPermissions,
addOrgUser,
updateOrgUserRole,
deleteOrgUser,
revokeSession,
revokeAllSessions,
syncLdapUser,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type Props = OwnProps & ConnectedProps<typeof connector>;
export default connector(UserAdminPage);
| public/app/features/admin/UserAdminPage.tsx | 1 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.9845698475837708,
0.0528896301984787,
0.00016909217811189592,
0.00019298229017294943,
0.21961040794849396
]
|
{
"id": 9,
"code_window": [
"\n",
"type Props = OwnProps & ConnectedProps<typeof connector>;\n",
"\n",
"const UserListAdminPageUnConnected: React.FC<Props> = ({\n",
" fetchUsers,\n",
" navModel,\n",
" query,\n",
" changeQuery,\n",
" users,\n",
" showPaging,\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "public/app/features/admin/UserListAdminPage.tsx",
"type": "replace",
"edit_start_line_idx": 61
} | export const GAUGE_DEFAULT_MINIMUM = 0;
export const GAUGE_DEFAULT_MAXIMUM = 100;
export const DEFAULT_SAML_NAME = 'SAML';
| packages/grafana-data/src/types/constants.ts | 0 | https://github.com/grafana/grafana/commit/05508081263463ad91316b4cae6c290669b12b48 | [
0.0001709669886622578,
0.0001709669886622578,
0.0001709669886622578,
0.0001709669886622578,
0
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.