hunk
dict | file
stringlengths 0
11.8M
| file_path
stringlengths 2
234
| label
int64 0
1
| commit_url
stringlengths 74
103
| dependency_score
sequencelengths 5
5
|
---|---|---|---|---|---|
{
"id": 2,
"code_window": [
" \"extends\": \"./tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"noEmit\": false,\n",
" \"emitDeclarationOnly\": true,\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/types/tsconfig.build.json",
"type": "replace",
"edit_start_line_idx": 6
} | import { rest } from 'msw';
import { setupServer } from 'msw/node';
const initialWebhooks = [
{ id: 1, isEnabled: true, name: 'test', url: 'http:://strapi.io' },
{ id: 2, isEnabled: false, name: 'test2', url: 'http://me.io' },
];
let webhooks = initialWebhooks;
export const resetWebhooks = () => {
webhooks = initialWebhooks;
};
const handlers = [
rest.get('*/webhooks', (req, res, ctx) => {
return res(
ctx.delay(100),
ctx.status(200),
ctx.json({
data: webhooks,
})
);
}),
rest.post('*/webhooks/batch-delete', (req, res, ctx) => {
webhooks = webhooks.filter((webhook) => !req.body.ids.includes(webhook.id));
return res(
ctx.status(200),
ctx.json({
data: webhooks,
})
);
}),
rest.put('*/webhooks/:id', (req, res, ctx) => {
const { id } = req.params;
const { isEnabled } = req.body;
webhooks = webhooks.map((webhook) =>
webhook.id === Number(id) ? { ...webhook, isEnabled } : webhook
);
return res(
ctx.status(200),
ctx.json({
data: webhooks,
})
);
}),
];
const server = setupServer(...handlers);
export default server;
| packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/ListView/tests/server.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00017146981554105878,
0.00016746041364967823,
0.0001643572759348899,
0.00016650822362862527,
0.0000025415313302801223
] |
{
"id": 2,
"code_window": [
" \"extends\": \"./tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"noEmit\": false,\n",
" \"emitDeclarationOnly\": true,\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/types/tsconfig.build.json",
"type": "replace",
"edit_start_line_idx": 6
} | import { toLower, castArray, trim, prop, isNil } from 'lodash/fp';
import type { Strapi, Common } from '@strapi/types';
import { errors } from '@strapi/utils';
import Router from '@koa/router';
import compose from 'koa-compose';
import { resolveRouteMiddlewares } from './middleware';
import { resolvePolicies } from './policy';
const getMethod = (route: Common.Route) => {
return trim(toLower(route.method)) as Lowercase<Common.Route['method']>;
};
const getPath = (route: Common.Route) => trim(route.path);
const createRouteInfoMiddleware =
(routeInfo: Common.Route): Common.MiddlewareHandler =>
(ctx, next) => {
const route = {
...routeInfo,
config: routeInfo.config || {},
};
ctx.state.route = route;
return next();
};
const getAuthConfig = prop('config.auth');
const createAuthorizeMiddleware =
(strapi: Strapi): Common.MiddlewareHandler =>
async (ctx, next) => {
const { auth, route } = ctx.state;
const authService = strapi.container.get('auth');
try {
await authService.verify(auth, getAuthConfig(route));
return await next();
} catch (error) {
if (error instanceof errors.UnauthorizedError) {
return ctx.unauthorized();
}
if (error instanceof errors.ForbiddenError) {
return ctx.forbidden();
}
throw error;
}
};
const createAuthenticateMiddleware =
(strapi: Strapi): Common.MiddlewareHandler =>
async (ctx, next) => {
return strapi.container.get('auth').authenticate(ctx, next);
};
const returnBodyMiddleware: Common.MiddlewareHandler = async (ctx, next) => {
const values = await next();
if (isNil(ctx.body) && !isNil(values)) {
ctx.body = values;
}
};
export default (strapi: Strapi) => {
const authenticate = createAuthenticateMiddleware(strapi);
const authorize = createAuthorizeMiddleware(strapi);
return (route: Common.Route, { router }: { router: Router }) => {
try {
const method = getMethod(route);
const path = getPath(route);
const middlewares = resolveRouteMiddlewares(route, strapi);
const policies = resolvePolicies(route);
const action = getAction(route, strapi);
const routeHandler = compose([
createRouteInfoMiddleware(route),
authenticate,
authorize,
...policies,
...middlewares,
returnBodyMiddleware,
...castArray(action),
]);
router[method](path, routeHandler);
} catch (error) {
if (error instanceof Error) {
error.message = `Error creating endpoint ${route.method} ${route.path}: ${error.message}`;
}
throw error;
}
};
};
const getController = (name: string, { pluginName, apiName }: Common.RouteInfo, strapi: Strapi) => {
let ctrl: Common.Controller | undefined;
if (pluginName) {
if (pluginName === 'admin') {
ctrl = strapi.controller(`admin::${name}`);
} else {
ctrl = strapi.plugin(pluginName).controller(name);
}
} else if (apiName) {
ctrl = strapi.controller(`api::${apiName}.${name}`);
}
if (!ctrl) {
return strapi.controller(name as Common.UID.Controller);
}
return ctrl;
};
const extractHandlerParts = (name: string) => {
const controllerName = name.slice(0, name.lastIndexOf('.'));
const actionName = name.slice(name.lastIndexOf('.') + 1);
return { controllerName, actionName };
};
const getAction = (route: Common.Route, strapi: Strapi) => {
const { handler, info } = route;
const { pluginName, apiName, type } = info ?? {};
if (Array.isArray(handler) || typeof handler === 'function') {
return handler;
}
const { controllerName, actionName } = extractHandlerParts(trim(handler));
const controller = getController(controllerName, { pluginName, apiName, type }, strapi);
if (typeof controller[actionName] !== 'function') {
throw new Error(`Handler not found "${handler}"`);
}
if (Symbol.for('__type__') in controller[actionName]) {
(controller[actionName] as any)[Symbol.for('__type__')].push(type);
} else {
(controller[actionName] as any)[Symbol.for('__type__')] = [type];
}
return controller[actionName].bind(controller);
};
| packages/core/strapi/src/services/server/compose-endpoint.ts | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.0001742081221891567,
0.0001698009727988392,
0.0001654268999118358,
0.00017004282562993467,
0.000002528359573261696
] |
{
"id": 3,
"code_window": [
"{\n",
" \"extends\": \"tsconfig/base.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/utils/tsconfig.json",
"type": "replace",
"edit_start_line_idx": 4
} | {
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"sourceMap": true,
"resolveJsonModule": true,
"noImplicitThis": true
}
}
| packages/utils/tsconfig/base.json | 1 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00029120786348357797,
0.0002323934604646638,
0.00017357905744574964,
0.0002323934604646638,
0.00005881440301891416
] |
{
"id": 3,
"code_window": [
"{\n",
" \"extends\": \"tsconfig/base.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/utils/tsconfig.json",
"type": "replace",
"edit_start_line_idx": 4
} | const customFieldDefaultOptionsReducer = (acc, option) => {
if (option.items) {
return option.items.reduce(customFieldDefaultOptionsReducer, acc);
}
if ('defaultValue' in option) {
const { name, defaultValue } = option;
acc.push({ name, defaultValue });
}
return acc;
};
export { customFieldDefaultOptionsReducer };
| packages/core/content-type-builder/admin/src/components/FormModal/utils/customFieldDefaultOptionsReducer.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.0001782952604116872,
0.00017599161947146058,
0.0001736879930831492,
0.00017599161947146058,
0.0000023036336642690003
] |
{
"id": 3,
"code_window": [
"{\n",
" \"extends\": \"tsconfig/base.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/utils/tsconfig.json",
"type": "replace",
"edit_start_line_idx": 4
} | 'use strict';
const { prop, propEq, identity, merge } = require('lodash/fp');
const { ValidationError } = require('@strapi/utils').errors;
const LOCALE_SCALAR_TYPENAME = 'I18NLocaleCode';
const LOCALE_ARG_PLUGIN_NAME = 'I18NLocaleArg';
const getLocalizedTypesFromRegistry = ({ strapi, typeRegistry }) => {
const { KINDS } = strapi.plugin('graphql').service('constants');
const { isLocalizedContentType } = strapi.plugin('i18n').service('content-types');
return typeRegistry.where(
({ config }) => config.kind === KINDS.type && isLocalizedContentType(config.contentType)
);
};
module.exports = ({ strapi }) => ({
register() {
const { service: getGraphQLService } = strapi.plugin('graphql');
const { service: getI18NService } = strapi.plugin('i18n');
const { isLocalizedContentType } = getI18NService('content-types');
const extensionService = getGraphQLService('extension');
const getCreateLocalizationMutationType = (contentType) => {
const { getTypeName } = getGraphQLService('utils').naming;
return `create${getTypeName(contentType)}Localization`;
};
extensionService.shadowCRUD('plugin::i18n.locale').disableMutations();
// Disable unwanted fields for localized content types
Object.entries(strapi.contentTypes).forEach(([uid, ct]) => {
if (isLocalizedContentType(ct)) {
// Disable locale field in localized inputs
extensionService.shadowCRUD(uid).field('locale').disableInput();
// Disable localizations field in localized inputs
extensionService.shadowCRUD(uid).field('localizations').disableInput();
}
});
extensionService.use(({ nexus, typeRegistry }) => {
const i18nLocaleArgPlugin = getI18nLocaleArgPlugin({ nexus, typeRegistry });
const i18nLocaleScalar = getLocaleScalar({ nexus });
const {
mutations: createLocalizationMutations,
resolversConfig: createLocalizationResolversConfig,
} = getCreateLocalizationMutations({ nexus, typeRegistry });
return {
plugins: [i18nLocaleArgPlugin],
types: [i18nLocaleScalar, createLocalizationMutations],
resolversConfig: {
// Auth for createLocalization mutations
...createLocalizationResolversConfig,
// locale arg transformation for localized createEntity mutations
...getLocalizedCreateMutationsResolversConfigs({ typeRegistry }),
// Modify the default scope associated to find and findOne locale queries to match the actual action name
'Query.i18NLocale': { auth: { scope: 'plugin::i18n.locales.listLocales' } },
'Query.i18NLocales': { auth: { scope: 'plugin::i18n.locales.listLocales' } },
},
};
});
const getLocaleScalar = ({ nexus }) => {
const locales = getI18NService('iso-locales').getIsoLocales();
return nexus.scalarType({
name: LOCALE_SCALAR_TYPENAME,
description: 'A string used to identify an i18n locale',
serialize: identity,
parseValue: identity,
parseLiteral(ast) {
if (ast.kind !== 'StringValue') {
throw new ValidationError('Locale cannot represent non string type');
}
const isValidLocale = ast.value === 'all' || locales.find(propEq('code', ast.value));
if (!isValidLocale) {
throw new ValidationError('Unknown locale supplied');
}
return ast.value;
},
});
};
const getCreateLocalizationMutations = ({ nexus, typeRegistry }) => {
const localizedContentTypes = getLocalizedTypesFromRegistry({ strapi, typeRegistry }).map(
prop('config.contentType')
);
const createLocalizationComponents = localizedContentTypes.map((ct) =>
getCreateLocalizationComponents(ct, { nexus })
);
// Extract & merge each resolverConfig into a single object
const resolversConfig = createLocalizationComponents
.map(prop('resolverConfig'))
.reduce(merge, {});
const mutations = createLocalizationComponents.map(prop('mutation'));
return { mutations, resolversConfig };
};
const getCreateLocalizationComponents = (contentType, { nexus }) => {
const { getEntityResponseName, getContentTypeInputName } = getGraphQLService('utils').naming;
const { createCreateLocalizationHandler } = getI18NService('core-api');
const responseType = getEntityResponseName(contentType);
const mutationName = getCreateLocalizationMutationType(contentType);
const resolverHandler = createCreateLocalizationHandler(contentType);
const mutation = nexus.extendType({
type: 'Mutation',
definition(t) {
t.field(mutationName, {
type: responseType,
// The locale arg will be automatically added through the i18n graphql extension
args: {
id: 'ID',
data: getContentTypeInputName(contentType),
},
async resolve(parent, args) {
const { id, locale, data } = args;
const ctx = {
id,
data: { ...data, locale },
};
const value = await resolverHandler(ctx);
return { value, info: { args, resourceUID: contentType.uid } };
},
});
},
});
const resolverConfig = {
[`Mutation.${mutationName}`]: {
auth: {
scope: [`${contentType.uid}.createLocalization`],
},
},
};
return { mutation, resolverConfig };
};
const getLocalizedCreateMutationsResolversConfigs = ({ typeRegistry }) => {
const localizedCreateMutationsNames = getLocalizedTypesFromRegistry({
strapi,
typeRegistry,
})
.map(prop('config.contentType'))
.map(getGraphQLService('utils').naming.getCreateMutationTypeName);
return localizedCreateMutationsNames.reduce(
(acc, mutationName) => ({
...acc,
[`Mutation.${mutationName}`]: {
middlewares: [
// Set data's locale using args' locale
(resolve, parent, args, context, info) => {
args.data.locale = args.locale;
return resolve(parent, args, context, info);
},
],
},
}),
{}
);
};
const getI18nLocaleArgPlugin = ({ nexus, typeRegistry }) => {
const { isLocalizedContentType } = getI18NService('content-types');
const addLocaleArg = (config) => {
const { parentType } = config;
// Only target queries or mutations
if (parentType !== 'Query' && parentType !== 'Mutation') {
return;
}
const registryType = typeRegistry.get(config.type);
if (!registryType) {
return;
}
const { contentType } = registryType.config;
// Ignore non-localized content types
if (!isLocalizedContentType(contentType)) {
return;
}
config.args.locale = nexus.arg({ type: LOCALE_SCALAR_TYPENAME });
};
return nexus.plugin({
name: LOCALE_ARG_PLUGIN_NAME,
onAddOutputField(config) {
// Add the locale arg to the queries on localized CTs
addLocaleArg(config);
},
});
};
},
});
| packages/plugins/i18n/server/graphql.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00019693118520081043,
0.0001728382776491344,
0.00016489492554683238,
0.00017101847333833575,
0.000006885580205562292
] |
{
"id": 3,
"code_window": [
"{\n",
" \"extends\": \"tsconfig/base.json\",\n",
" \"compilerOptions\": {\n",
" \"outDir\": \"dist\",\n",
" \"declarationMap\": true,\n",
" },\n",
" \"include\": [\"src\"],\n",
" \"exclude\": [\"node_modules\", \"**/__tests__/**\"]\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "packages/core/utils/tsconfig.json",
"type": "replace",
"edit_start_line_idx": 4
} | import { Readable } from 'stream';
import type { LoadedStrapi } from '@strapi/types';
import type { ILink } from '../../../../types';
import { createLinkQuery } from '../../queries/link';
/**
* Create a Readable which will stream all the links from a Strapi instance
*/
export const createLinksStream = (strapi: LoadedStrapi): Readable => {
const uids = [...Object.keys(strapi.contentTypes), ...Object.keys(strapi.components)] as string[];
// Async generator stream that returns every link from a Strapi instance
return Readable.from(
(async function* linkGenerator(): AsyncGenerator<ILink> {
const query = createLinkQuery(strapi);
for (const uid of uids) {
const generator = query().generateAll(uid);
for await (const link of generator) {
yield link;
}
}
})()
);
};
| packages/core/data-transfer/src/strapi/providers/local-source/links.ts | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.0001740074367262423,
0.00017093967471737415,
0.0001661444257479161,
0.0001726671907817945,
0.0000034346221582381986
] |
{
"id": 4,
"code_window": [
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"extends\": \"@tsconfig/node18/tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"declaration\": true,\n",
" \"esModuleInterop\": true,\n",
" \"sourceMap\": true,\n",
" \"resolveJsonModule\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/base.json",
"type": "add",
"edit_start_line_idx": 5
} | {
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"noEmit": true,
"jsx": "react-jsx"
}
}
| packages/utils/tsconfig/client.json | 1 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.008368957787752151,
0.004284508991986513,
0.00020006019622087479,
0.004284508991986513,
0.004084448795765638
] |
{
"id": 4,
"code_window": [
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"extends\": \"@tsconfig/node18/tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"declaration\": true,\n",
" \"esModuleInterop\": true,\n",
" \"sourceMap\": true,\n",
" \"resolveJsonModule\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/base.json",
"type": "add",
"edit_start_line_idx": 5
} | import chalk from 'chalk';
import { isString, isArray } from 'lodash/fp';
import type { Command } from 'commander';
const bytesPerKb = 1024;
const sizes = ['B ', 'KB', 'MB', 'GB', 'TB', 'PB'];
/**
* Convert bytes to a human readable formatted string, for example "1024" becomes "1KB"
*/
const readableBytes = (bytes: number, decimals = 1, padStart = 0) => {
if (!bytes) {
return '0';
}
const i = Math.floor(Math.log(bytes) / Math.log(bytesPerKb));
const result = `${parseFloat((bytes / bytesPerKb ** i).toFixed(decimals))} ${sizes[i].padStart(
2
)}`;
return result.padStart(padStart);
};
interface ExitWithOptions {
logger?: Console;
prc?: NodeJS.Process;
}
/**
*
* Display message(s) to console and then call process.exit with code.
* If code is zero, console.log and green text is used for messages, otherwise console.error and red text.
*
*/
const exitWith = (code: number, message?: string | string[], options: ExitWithOptions = {}) => {
const { logger = console, prc = process } = options;
const log = (message: string) => {
if (code === 0) {
logger.log(chalk.green(message));
} else {
logger.error(chalk.red(message));
}
};
if (isString(message)) {
log(message);
} else if (isArray(message)) {
message.forEach((msg) => log(msg));
}
prc.exit(code);
};
/**
* assert that a URL object has a protocol value
*
*/
const assertUrlHasProtocol = (url: URL, protocol?: string | string[]) => {
if (!url.protocol) {
exitWith(1, `${url.toString()} does not have a protocol`);
}
// if just checking for the existence of a protocol, return
if (!protocol) {
return;
}
if (isString(protocol)) {
if (protocol !== url.protocol) {
exitWith(1, `${url.toString()} must have the protocol ${protocol}`);
}
return;
}
// assume an array
if (!protocol.some((protocol) => url.protocol === protocol)) {
return exitWith(
1,
`${url.toString()} must have one of the following protocols: ${protocol.join(',')}`
);
}
};
type ConditionCallback = (opts: Record<string, any>) => Promise<boolean>;
type IsMetCallback = (command: Command) => Promise<void>;
type IsNotMetCallback = (command: Command) => Promise<void>;
/**
* Passes commander options to conditionCallback(). If it returns true, call isMetCallback otherwise call isNotMetCallback
*/
const ifOptions = (
conditionCallback: ConditionCallback,
isMetCallback: IsMetCallback = async () => {},
isNotMetCallback: IsNotMetCallback = async () => {}
) => {
return async (command: Command) => {
const opts = command.opts();
if (await conditionCallback(opts)) {
await isMetCallback(command);
} else {
await isNotMetCallback(command);
}
};
};
export { exitWith, assertUrlHasProtocol, ifOptions, readableBytes };
| packages/core/data-transfer/src/commands/helpers.ts | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00018003143486566842,
0.00017158211267087609,
0.00016654570936225355,
0.00017097806266974658,
0.0000031770937312103342
] |
{
"id": 4,
"code_window": [
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"extends\": \"@tsconfig/node18/tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"declaration\": true,\n",
" \"esModuleInterop\": true,\n",
" \"sourceMap\": true,\n",
" \"resolveJsonModule\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/base.json",
"type": "add",
"edit_start_line_idx": 5
} | 'use strict';
const _ = require('lodash');
const { ApplicationError } = require('@strapi/utils').errors;
const {
validatePassword,
hashPassword,
checkCredentials,
forgotPassword,
resetPassword,
} = require('../auth');
describe('Auth', () => {
describe('checkCredentials', () => {
test('Fails on not found user, without leaking not found info', async () => {
const findOne = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
};
const input = { email: '[email protected]', password: 'pcw123' };
const res = await checkCredentials(input);
expect(findOne).toHaveBeenCalledWith({ where: { email: input.email } });
expect(res).toEqual([null, false, { message: 'Invalid credentials' }]);
});
test('Fails when password is invalid, without leaking specific info', async () => {
const user = {
id: 1,
firstname: '',
lastname: '',
email: '[email protected]',
password: await hashPassword('test-password'),
};
const findOne = jest.fn(() => Promise.resolve(user));
global.strapi = {
query() {
return { findOne };
},
};
const input = { email: '[email protected]', password: 'wrong-password' };
const res = await checkCredentials(input);
expect(findOne).toHaveBeenCalledWith({ where: { email: input.email } });
expect(res).toEqual([null, false, { message: 'Invalid credentials' }]);
});
test.each([false, null, 1, 0])('Fails when user is not active (%s)', async (isActive) => {
const user = {
id: 1,
firstname: '',
lastname: '',
email: '[email protected]',
isActive,
password: await hashPassword('test-password'),
};
const findOne = jest.fn(() => Promise.resolve(user));
global.strapi = {
query() {
return { findOne };
},
};
const input = { email: '[email protected]', password: 'test-password' };
const res = await checkCredentials(input);
expect(findOne).toHaveBeenCalledWith({ where: { email: input.email } });
expect(res).toEqual([null, false, { message: 'User not active' }]);
});
test('Returns user when all checks pass', async () => {
const user = {
id: 1,
firstname: '',
lastname: '',
email: '[email protected]',
isActive: true,
password: await hashPassword('test-password'),
};
const findOne = jest.fn(() => Promise.resolve(user));
global.strapi = {
query() {
return { findOne };
},
};
const input = { email: '[email protected]', password: 'test-password' };
const res = await checkCredentials(input);
expect(findOne).toHaveBeenCalledWith({ where: { email: input.email } });
expect(res).toEqual([null, user]);
});
});
describe('validatePassword', () => {
test('Compares password with hash (matching passwords)', async () => {
const password = 'pcw123';
const hash = await hashPassword(password);
const isValid = await validatePassword(password, hash);
expect(isValid).toBe(true);
});
test('Compares password with hash (not matching passwords)', async () => {
const password = 'pcw123';
const password2 = 'pcs1234';
const hash = await hashPassword(password2);
const isValid = await validatePassword(password, hash);
expect(isValid).toBe(false);
});
});
describe('forgotPassword', () => {
test('Only run the process for active users', async () => {
const findOne = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
};
const input = { email: '[email protected]' };
await forgotPassword(input);
expect(findOne).toHaveBeenCalledWith({ where: { email: input.email, isActive: true } });
});
test('Will return silently in case the user is not found', async () => {
const findOne = jest.fn(() => Promise.resolve());
const send = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
plugins: {
email: {
services: {
email: { send },
},
},
},
};
const input = { email: '[email protected]' };
await forgotPassword(input);
expect(findOne).toHaveBeenCalled();
expect(send).not.toHaveBeenCalled();
});
test('Will assign a new reset token', async () => {
const user = {
id: 1,
email: '[email protected]',
};
const resetPasswordToken = '123';
const findOne = jest.fn(() => Promise.resolve(user));
const send = jest.fn(() => Promise.resolve());
const updateById = jest.fn(() => Promise.resolve());
const createToken = jest.fn(() => resetPasswordToken);
const config = {
server: {
host: '0.0.0.0',
},
admin: { url: '/admin' },
};
global.strapi = {
config: {
...config,
get(path, def) {
return _.get(path, def);
},
},
query() {
return { findOne };
},
admin: { services: { user: { updateById }, token: { createToken } } },
plugins: { email: { services: { email: { send, sendTemplatedEmail: send } } } },
};
const input = { email: user.email };
await forgotPassword(input);
expect(findOne).toHaveBeenCalled();
expect(createToken).toHaveBeenCalled();
expect(updateById).toHaveBeenCalledWith(user.id, { resetPasswordToken });
});
test('Will call the send service', async () => {
const user = {
id: 1,
email: '[email protected]',
};
const resetPasswordToken = '123';
const findOne = jest.fn(() => Promise.resolve(user));
const send = jest.fn(() => Promise.resolve());
const sendTemplatedEmail = jest.fn(() => Promise.resolve());
const updateById = jest.fn(() => Promise.resolve());
const createToken = jest.fn(() => resetPasswordToken);
const config = {
server: {
host: '0.0.0.0',
admin: { url: '/admin', forgotPassword: { emailTemplate: {} } },
},
};
global.strapi = {
config: {
...config,
get(path, def) {
return _.get(path, def);
},
},
query() {
return { findOne };
},
admin: {
services: {
user: { updateById },
token: { createToken },
},
},
plugins: { email: { services: { email: { send, sendTemplatedEmail } } } },
};
const input = { email: user.email };
await forgotPassword(input);
expect(findOne).toHaveBeenCalled();
expect(createToken).toHaveBeenCalled();
expect(sendTemplatedEmail).toHaveBeenCalled();
});
});
describe('resetPassword', () => {
test('Check user is active', async () => {
const resetPasswordToken = '123';
const findOne = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
};
expect.assertions(2);
try {
await resetPassword({ resetPasswordToken, password: 'Test1234' });
} catch (e) {
expect(e instanceof ApplicationError).toBe(true);
}
expect(findOne).toHaveBeenCalledWith({ where: { resetPasswordToken, isActive: true } });
});
test('Fails if user is not found', async () => {
const resetPasswordToken = '123';
const findOne = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
};
expect.assertions(1);
try {
await resetPassword({ resetPasswordToken, password: 'Test1234' });
} catch (e) {
expect(e instanceof ApplicationError).toBe(true);
}
});
test('Changes password and clear reset token', async () => {
const resetPasswordToken = '123';
const user = { id: 1 };
const findOne = jest.fn(() => Promise.resolve(user));
const updateById = jest.fn(() => Promise.resolve());
global.strapi = {
query() {
return { findOne };
},
admin: { services: { user: { updateById } } },
};
const input = { resetPasswordToken, password: 'Test1234' };
await resetPassword(input);
expect(updateById).toHaveBeenCalledWith(user.id, {
password: input.password,
resetPasswordToken: null,
});
});
});
});
| packages/core/admin/server/services/__tests__/auth.test.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00017808731354307383,
0.00017282516637351364,
0.00016480847261846066,
0.00017324744840152562,
0.000002866602699214127
] |
{
"id": 4,
"code_window": [
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"extends\": \"@tsconfig/node18/tsconfig.json\",\n",
" \"compilerOptions\": {\n",
" \"declaration\": true,\n",
" \"esModuleInterop\": true,\n",
" \"sourceMap\": true,\n",
" \"resolveJsonModule\": true,\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/base.json",
"type": "add",
"edit_start_line_idx": 5
} | 'use strict';
const createContext = require('../../../../../../test/helpers/create-context');
const permissionController = require('../permission');
describe('Permission Controller', () => {
const localTestData = {
permissions: {
valid: [
{ action: 'read', subject: 'article', field: 'title' },
{ action: 'read', subject: 'article' },
{ action: 'read' },
],
invalid: [
{ action: {}, subject: '', field: '' },
{ subject: 'article', field: 'title' },
{ action: 'read', subject: {}, field: 'title' },
{ action: 'read', subject: 'article', field: {} },
{ action: 'read', subject: 'article', field: 'title', foo: 'bar' },
],
},
ability: {
can: jest.fn(() => true),
},
badRequest: jest.fn(),
};
global.strapi = {
admin: {
services: {
permission: {
engine: {
checkMany: jest.fn((ability) => (permissions) => {
return permissions.map(({ action, subject, field }) =>
ability.can(action, subject, field)
);
}),
},
},
},
},
};
afterEach(async () => {
jest.clearAllMocks();
});
describe('Check Many Permissions', () => {
test('Invalid Permission Shape (bad type for action)', async () => {
const ctx = createContext(
{ body: { permissions: [localTestData.permissions.invalid[0]] } },
{ state: { userAbility: localTestData.ability }, badRequest: localTestData.badRequest }
);
expect.assertions(1);
try {
await permissionController.check(ctx);
} catch (e) {
expect(e).toMatchObject({
name: 'ValidationError',
message: 'permissions[0].action must be a `string` type, but the final value was: `{}`.',
details: {
errors: [
{
path: ['permissions', '0', 'action'],
message:
'permissions[0].action must be a `string` type, but the final value was: `{}`.',
name: 'ValidationError',
},
],
},
});
}
});
test('Invalid Permission Shape (missing required action)', async () => {
const ctx = createContext(
{ body: { permissions: [localTestData.permissions.invalid[1]] } },
{ state: { userAbility: localTestData.ability }, badRequest: localTestData.badRequest }
);
expect.assertions(1);
try {
await permissionController.check(ctx);
} catch (e) {
expect(e).toMatchObject({
name: 'ValidationError',
message: 'permissions[0].action is a required field',
details: {
errors: [
{
path: ['permissions', '0', 'action'],
message: 'permissions[0].action is a required field',
name: 'ValidationError',
},
],
},
});
}
});
test('Invalid Permission Shape (bad type for subject)', async () => {
const ctx = createContext(
{ body: { permissions: [localTestData.permissions.invalid[2]] } },
{ state: { userAbility: localTestData.ability }, badRequest: localTestData.badRequest }
);
expect.assertions(1);
try {
await permissionController.check(ctx);
} catch (e) {
expect(e).toMatchObject({
name: 'ValidationError',
message: 'permissions[0].subject must be a `string` type, but the final value was: `{}`.',
details: {
errors: [
{
path: ['permissions', '0', 'subject'],
message:
'permissions[0].subject must be a `string` type, but the final value was: `{}`.',
name: 'ValidationError',
},
],
},
});
}
});
test('Invalid Permission Shape (bad type for field)', async () => {
const ctx = createContext(
{ body: { permissions: [localTestData.permissions.invalid[3]] } },
{ state: { userAbility: localTestData.ability }, badRequest: localTestData.badRequest }
);
expect.assertions(1);
try {
await permissionController.check(ctx);
} catch (e) {
expect(e).toMatchObject({
name: 'ValidationError',
message: 'permissions[0].field must be a `string` type, but the final value was: `{}`.',
details: {
errors: [
{
path: ['permissions', '0', 'field'],
message:
'permissions[0].field must be a `string` type, but the final value was: `{}`.',
name: 'ValidationError',
},
],
},
});
}
});
test('Invalid Permission Shape (unrecognized foo param)', async () => {
const ctx = createContext(
{ body: { permissions: [localTestData.permissions.invalid[4]] } },
{ state: { userAbility: localTestData.ability }, badRequest: localTestData.badRequest }
);
expect.assertions(1);
try {
await permissionController.check(ctx);
} catch (e) {
expect(e).toMatchObject({
name: 'ValidationError',
message: 'permissions[0] field has unspecified keys: foo',
details: {
errors: [
{
path: ['permissions', '0'],
message: 'permissions[0] field has unspecified keys: foo',
name: 'ValidationError',
},
],
},
});
}
});
test('Check Many Permissions', async () => {
const ctx = createContext(
{ body: { permissions: localTestData.permissions.valid } },
{ state: { userAbility: localTestData.ability } }
);
await permissionController.check(ctx);
expect(localTestData.ability.can).toHaveBeenCalled();
expect(strapi.admin.services.permission.engine.checkMany).toHaveBeenCalled();
expect(ctx.body.data).toHaveLength(localTestData.permissions.valid.length);
});
});
});
| packages/core/admin/server/controllers/__tests__/permission.test.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.0001768391957739368,
0.0001750217634253204,
0.0001732694945530966,
0.0001749063521856442,
0.0000010276241937390296
] |
{
"id": 5,
"code_window": [
"{\n",
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"compilerOptions\": {\n",
" \"target\": \"ESNext\",\n",
" \"module\": \"ESNext\",\n",
" \"moduleResolution\": \"Bundler\",\n",
" \"useDefineForClassFields\": true,\n",
" \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/client.json",
"type": "add",
"edit_start_line_idx": 3
} | {
"extends": "./tsconfig.json",
"include": ["declarations", "src"],
"exclude": ["**/*.test.tsx", "**/*.test.ts"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build",
"declarationMap": true,
}
}
| packages/core/helper-plugin/tsconfig.build.json | 1 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00021131518587935716,
0.00019445543875917792,
0.00017759570619091392,
0.00019445543875917792,
0.000016859739844221622
] |
{
"id": 5,
"code_window": [
"{\n",
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"compilerOptions\": {\n",
" \"target\": \"ESNext\",\n",
" \"module\": \"ESNext\",\n",
" \"moduleResolution\": \"Bundler\",\n",
" \"useDefineForClassFields\": true,\n",
" \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/client.json",
"type": "add",
"edit_start_line_idx": 3
} | export type Q = string;
| packages/core/types/src/modules/entity-service/params/search.ts | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00017622298037167639,
0.00017622298037167639,
0.00017622298037167639,
0.00017622298037167639,
0
] |
{
"id": 5,
"code_window": [
"{\n",
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"compilerOptions\": {\n",
" \"target\": \"ESNext\",\n",
" \"module\": \"ESNext\",\n",
" \"moduleResolution\": \"Bundler\",\n",
" \"useDefineForClassFields\": true,\n",
" \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/client.json",
"type": "add",
"edit_start_line_idx": 3
} | ############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
############################
# Linux
############################
*~
############################
# Windows
############################
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
############################
# Packages
############################
*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid
############################
# Logs and databases
############################
.tmp
*.log
*.sql
*.sqlite
############################
# Misc.
############################
*#
.idea
nbproject
############################
# Node.js
############################
lib-cov
lcov.info
pids
logs
results
build
node_modules
.node_history
package-lock.json
| packages/providers/email-amazon-ses/.gitignore | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.0001765133929438889,
0.00017186038894578815,
0.00016544329992029816,
0.00017265402129851282,
0.0000032514344638912007
] |
{
"id": 5,
"code_window": [
"{\n",
" \"$schema\": \"http://json.schemastore.org/tsconfig\",\n",
" \"compilerOptions\": {\n",
" \"target\": \"ESNext\",\n",
" \"module\": \"ESNext\",\n",
" \"moduleResolution\": \"Bundler\",\n",
" \"useDefineForClassFields\": true,\n",
" \"lib\": [\"DOM\", \"DOM.Iterable\", \"ESNext\"],\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"declarationMap\": true,\n"
],
"file_path": "packages/utils/tsconfig/client.json",
"type": "add",
"edit_start_line_idx": 3
} | 'use strict';
class Dialect {
constructor(db) {
this.db = db;
}
configure() {}
initialize() {}
getSqlType(type) {
return type;
}
canAlterConstraints() {
return true;
}
usesForeignKeys() {
return false;
}
useReturning() {
return false;
}
supportsUnsigned() {
return false;
}
supportsWindowFunctions() {
return true;
}
supportsOperator() {
return true;
}
async startSchemaUpdate() {
// noop
}
async endSchemaUpdate() {
// noop
}
transformErrors(error) {
if (error instanceof Error) {
throw error;
}
throw new Error(error.message);
}
canAddIncrements() {
return true;
}
}
module.exports = {
Dialect,
};
| packages/core/database/lib/dialects/dialect.js | 0 | https://github.com/strapi/strapi/commit/eb0cebb965521ebc77eb3af75ceb457310c34bfb | [
0.00017934729112312198,
0.0001719427964417264,
0.00016812386456876993,
0.00017041231330949813,
0.000003629939328675391
] |
{
"id": 0,
"code_window": [
"{\n",
"\t\"account\": \"monacobuild\",\n",
"\t\"container\": \"debuggers\",\n",
"\t\"zip\": \"add5842/node-debug.zip\",\n",
"\t\"output\": \"\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"zip\": \"4271a18/node-debug.zip\",\n"
],
"file_path": "extensions/node-debug/node-debug.azure.json",
"type": "replace",
"edit_start_line_idx": 3
} | {
"name": "Code",
"version": "0.8.0-preview",
"dependencies": {
"applicationinsights": {
"version": "0.15.6",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz"
},
"chokidar": {
"version": "1.0.5",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.0.5.tgz",
"dependencies": {
"anymatch": {
"version": "1.3.0",
"from": "anymatch@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz",
"dependencies": {
"micromatch": {
"version": "2.2.0",
"from": "micromatch@>=2.1.5 <3.0.0",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.2.0.tgz",
"dependencies": {
"arr-diff": {
"version": "1.1.0",
"from": "arr-diff@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz",
"dependencies": {
"arr-flatten": {
"version": "1.0.1",
"from": "arr-flatten@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz"
},
"array-slice": {
"version": "0.2.3",
"from": "array-slice@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz"
}
}
},
"array-unique": {
"version": "0.2.1",
"from": "array-unique@>=0.2.1 <0.3.0",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz"
},
"braces": {
"version": "1.8.1",
"from": "braces@>=1.8.0 <2.0.0",
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.1.tgz",
"dependencies": {
"expand-range": {
"version": "1.8.1",
"from": "expand-range@>=1.8.1 <2.0.0",
"resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.1.tgz",
"dependencies": {
"fill-range": {
"version": "2.2.2",
"from": "fill-range@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.2.tgz",
"dependencies": {
"is-number": {
"version": "1.1.2",
"from": "is-number@>=1.1.2 <2.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-1.1.2.tgz"
},
"isobject": {
"version": "1.0.2",
"from": "isobject@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-1.0.2.tgz"
},
"randomatic": {
"version": "1.1.0",
"from": "randomatic@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.0.tgz"
},
"repeat-string": {
"version": "1.5.2",
"from": "repeat-string@>=1.5.2 <2.0.0",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.5.2.tgz"
}
}
}
}
},
"lazy-cache": {
"version": "0.2.3",
"from": "lazy-cache@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.3.tgz"
},
"preserve": {
"version": "0.2.0",
"from": "preserve@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz"
},
"repeat-element": {
"version": "1.1.2",
"from": "repeat-element@>=1.1.2 <2.0.0",
"resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz"
}
}
},
"expand-brackets": {
"version": "0.1.4",
"from": "expand-brackets@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.4.tgz"
},
"extglob": {
"version": "0.3.1",
"from": "extglob@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.1.tgz",
"dependencies": {
"ansi-green": {
"version": "0.1.1",
"from": "ansi-green@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/ansi-green/-/ansi-green-0.1.1.tgz",
"dependencies": {
"ansi-wrap": {
"version": "0.1.0",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz"
}
}
},
"is-extglob": {
"version": "1.0.0",
"from": "is-extglob@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz"
},
"success-symbol": {
"version": "0.1.0",
"from": "success-symbol@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/success-symbol/-/success-symbol-0.1.0.tgz"
}
}
},
"filename-regex": {
"version": "2.0.0",
"from": "filename-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.0.tgz"
},
"kind-of": {
"version": "1.1.0",
"from": "kind-of@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz"
},
"object.omit": {
"version": "1.1.0",
"from": "object.omit@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/object.omit/-/object.omit-1.1.0.tgz",
"dependencies": {
"for-own": {
"version": "0.1.3",
"from": "for-own@>=0.1.3 <0.2.0",
"resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.3.tgz",
"dependencies": {
"for-in": {
"version": "0.1.4",
"from": "for-in@>=0.1.4 <0.2.0",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.4.tgz"
}
}
},
"isobject": {
"version": "1.0.2",
"from": "isobject@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-1.0.2.tgz"
}
}
},
"parse-glob": {
"version": "3.0.2",
"from": "parse-glob@>=3.0.1 <4.0.0",
"resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.2.tgz",
"dependencies": {
"glob-base": {
"version": "0.2.0",
"from": "glob-base@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.2.0.tgz"
},
"is-dotfile": {
"version": "1.0.1",
"from": "is-dotfile@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.1.tgz"
},
"is-extglob": {
"version": "1.0.0",
"from": "is-extglob@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz"
}
}
},
"regex-cache": {
"version": "0.4.2",
"from": "regex-cache@>=0.4.2 <0.5.0",
"resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.2.tgz",
"dependencies": {
"is-equal-shallow": {
"version": "0.1.3",
"from": "is-equal-shallow@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz"
},
"is-primitive": {
"version": "2.0.0",
"from": "is-primitive@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz"
}
}
}
}
}
}
},
"arrify": {
"version": "1.0.0",
"from": "arrify@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.0.tgz"
},
"async-each": {
"version": "0.1.6",
"from": "async-each@>=0.1.5 <0.2.0",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-0.1.6.tgz"
},
"glob-parent": {
"version": "1.2.0",
"from": "glob-parent@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-1.2.0.tgz"
},
"is-binary-path": {
"version": "1.0.1",
"from": "is-binary-path@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
"dependencies": {
"binary-extensions": {
"version": "1.3.1",
"from": "binary-extensions@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.3.1.tgz"
}
}
},
"is-glob": {
"version": "1.1.3",
"from": "is-glob@>=1.1.3 <2.0.0",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-1.1.3.tgz"
},
"path-is-absolute": {
"version": "1.0.0",
"from": "path-is-absolute@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz"
},
"readdirp": {
"version": "1.4.0",
"from": "readdirp@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-1.4.0.tgz",
"dependencies": {
"minimatch": {
"version": "0.2.14",
"from": "minimatch@>=0.2.12 <0.3.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz",
"dependencies": {
"lru-cache": {
"version": "2.6.5",
"from": "lru-cache@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz"
},
"sigmund": {
"version": "1.0.1",
"from": "sigmund@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz"
}
}
},
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.26-2 <1.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
}
}
},
"fsevents": {
"version": "0.3.8",
"from": "fsevents@>=0.3.1 <0.4.0",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz",
"dependencies": {
"nan": {
"version": "2.0.8",
"from": "nan@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.8.tgz"
}
}
}
}
},
"emmet": {
"version": "1.3.1",
"from": "emmet@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/emmet/-/emmet-1.3.1.tgz"
},
"getmac": {
"version": "1.0.7",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/getmac/-/getmac-1.0.7.tgz",
"dependencies": {
"extract-opts": {
"version": "2.2.0",
"from": "extract-opts@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/extract-opts/-/extract-opts-2.2.0.tgz",
"dependencies": {
"typechecker": {
"version": "2.0.8",
"from": "typechecker@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz"
}
}
}
}
},
"graceful-fs": {
"version": "4.1.2",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz"
},
"http-proxy-agent": {
"version": "0.2.7",
"from": "http-proxy-agent@>=0.2.6 <0.3.0",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-0.2.7.tgz",
"dependencies": {
"agent-base": {
"version": "1.0.2",
"from": "agent-base@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-1.0.2.tgz"
},
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
},
"debug": {
"version": "2.2.0",
"from": "debug@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"dependencies": {
"ms": {
"version": "0.7.1",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
}
}
}
}
},
"https-proxy-agent": {
"version": "0.3.6",
"from": "https-proxy-agent@>=0.3.5 <0.4.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-0.3.6.tgz",
"dependencies": {
"agent-base": {
"version": "1.0.2",
"from": "agent-base@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-1.0.2.tgz"
},
"debug": {
"version": "2.2.0",
"from": "debug@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"dependencies": {
"ms": {
"version": "0.7.1",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
}
}
},
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
}
}
},
"iconv-lite": {
"version": "0.4.13",
"from": "iconv-lite@>=0.4.7 <0.5.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz"
},
"sax": {
"version": "1.1.2",
"from": "sax@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.1.2.tgz"
},
"semver": {
"version": "4.3.6",
"from": "semver@>=4.2.0 <5.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz"
},
"vscode-debugprotocol": {
"version": "1.5.0",
"from": "vscode-debugprotocol@>=1.5.0",
"resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.5.0.tgz"
},
"vscode-textmate": {
"version": "1.0.11",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-1.0.11.tgz",
"dependencies": {
"oniguruma": {
"version": "6.0.1",
"from": "oniguruma@>=6.0.0 <7.0.0",
"resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-6.0.1.tgz",
"dependencies": {
"nan": {
"version": "2.0.9",
"from": "nan@>=2.0.9 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.9.tgz"
}
}
},
"sax": {
"version": "1.1.2",
"from": "sax@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.1.2.tgz"
}
}
},
"native-keymap": {
"version": "0.1.2",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-0.1.2.tgz"
},
"weak": {
"version": "1.0.1",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/weak/-/weak-1.0.1.tgz",
"dependencies": {
"bindings": {
"version": "1.2.1",
"from": "bindings@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "2.2.0",
"from": "nan@>=2.0.5 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
}
}
},
"winreg": {
"version": "0.0.12",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/winreg/-/winreg-0.0.12.tgz"
},
"yauzl": {
"version": "2.3.1",
"from": "yauzl@>=2.3.1 <3.0.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.3.1.tgz",
"dependencies": {
"fd-slicer": {
"version": "1.0.1",
"from": "fd-slicer@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz"
},
"pend": {
"version": "1.2.0",
"from": "pend@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz"
}
}
},
"windows-mutex": {
"version": "0.2.0",
"from": "[email protected]",
"dependencies": {
"bindings": {
"version": "1.2.1",
"from": "bindings@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "2.1.0",
"from": "nan@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz"
}
}
}
}
}
| npm-shrinkwrap.json | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017467902216594666,
0.00016993985627777874,
0.00016453526041004807,
0.00016969673743005842,
0.000002391345560681657
] |
{
"id": 0,
"code_window": [
"{\n",
"\t\"account\": \"monacobuild\",\n",
"\t\"container\": \"debuggers\",\n",
"\t\"zip\": \"add5842/node-debug.zip\",\n",
"\t\"output\": \"\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"zip\": \"4271a18/node-debug.zip\",\n"
],
"file_path": "extensions/node-debug/node-debug.azure.json",
"type": "replace",
"edit_start_line_idx": 3
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/languages/html/common/html.contribution';
import 'vs/languages/javascript/common/javascript.contribution';
import assert = require('assert');
import EditorCommon = require('vs/editor/common/editorCommon');
import Modes = require('vs/editor/common/modes');
import modesUtil = require('vs/editor/test/common/modesUtil');
import {Model} from 'vs/editor/common/model/model';
import {getTag, DELIM_END, DELIM_START, DELIM_ASSIGN, ATTRIB_NAME, ATTRIB_VALUE, COMMENT, DELIM_COMMENT, DELIM_DOCTYPE, DOCTYPE} from 'vs/languages/html/common/htmlTokenTypes';
import {getRawEnterActionAtPosition} from 'vs/editor/common/modes/supports/onEnter';
import {TextModelWithTokens} from 'vs/editor/common/model/textModelWithTokens';
import {TextModel} from 'vs/editor/common/model/textModel';
import {Range} from 'vs/editor/common/core/range';
suite('Colorizing - HTML', () => {
var tokenizationSupport: Modes.ITokenizationSupport;
var _mode: Modes.IMode;
suiteSetup((done) => {
modesUtil.load('html', ['javascript']).then(mode => {
tokenizationSupport = mode.tokenizationSupport;
_mode = mode;
done();
});
});
test('Open Start Tag #1', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') }
]}
]);
});
test('Open Start Tag #2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<input',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('input') }
]}
]);
});
test('Open Start Tag with Invalid Tag', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '< abc',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: '' }
]}
]);
});
test('Open Start Tag #3', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '< abc>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: '' }
]}
]);
});
test('Open Start Tag #4', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: 'i <len;',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:2, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:3, type: getTag('len') },
{ startIndex:6, type: '' }
]}
]);
});
test('Open Start Tag #5', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open }
]}
]);
});
test('Open End Tag', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '</a',
tokens: [
{ startIndex:0, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:2, type: getTag('a') }
]}
]);
});
test('Complete Start Tag', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Complete Start Tag with Whitespace', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc >',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('bug 9809 - Complete Start Tag with Namespaceprefix', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<foo:bar>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('foo-bar') },
{ startIndex:8, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Complete End Tag', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '</abc>',
tokens: [
{ startIndex:0, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:2, type: getTag('abc') },
{ startIndex:5, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Complete End Tag with Whitespace', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '</abc >',
tokens: [
{ startIndex:0, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:2, type: getTag('abc') },
{ startIndex:5, type: '' },
{ startIndex:7, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Empty Tag', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc />',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #1', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript">var i= 10;</script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:31, type: 'keyword.js' },
{ startIndex:34, type: '' },
{ startIndex:35, type: 'identifier.js' },
{ startIndex:36, type: 'delimiter.js' },
{ startIndex:37, type: '' },
{ startIndex:38, type: 'number.js' },
{ startIndex:40, type: 'delimiter.js' },
{ startIndex:41, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:43, type: getTag('script') },
{ startIndex:49, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_START, bracket: Modes.Bracket.Close }
]}, {
line: 'var i= 10;',
tokens: [
{ startIndex:0, type: 'keyword.js' },
{ startIndex:3, type: '' },
{ startIndex:4, type: 'identifier.js' },
{ startIndex:5, type: 'delimiter.js' },
{ startIndex:6, type: '' },
{ startIndex:7, type: 'number.js' },
{ startIndex:9, type: 'delimiter.js' }
]}, {
line: '</script>',
tokens: [
{ startIndex:0, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:2, type: getTag('script') },
{ startIndex:8, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #3', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript">var i= 10;',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:31, type: 'keyword.js' },
{ startIndex:34, type: '' },
{ startIndex:35, type: 'identifier.js' },
{ startIndex:36, type: 'delimiter.js' },
{ startIndex:37, type: '' },
{ startIndex:38, type: 'number.js' },
{ startIndex:40, type: 'delimiter.js' }
]}, {
line: '</script>',
tokens: [
{ startIndex:0, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:2, type: getTag('script') },
{ startIndex:8, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #4', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_START, bracket: Modes.Bracket.Close }
]}, {
line: 'var i= 10;</script>',
tokens: [
{ startIndex:0, type: 'keyword.js' },
{ startIndex:3, type: '' },
{ startIndex:4, type: 'identifier.js' },
{ startIndex:5, type: 'delimiter.js' },
{ startIndex:6, type: '' },
{ startIndex:7, type: 'number.js' },
{ startIndex:9, type: 'delimiter.js' },
{ startIndex:10, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:12, type: getTag('script') },
{ startIndex:18, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #5', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/plain">a\n<a</script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:25, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:26, type: '' },
{ startIndex:30, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:32, type: getTag('script') },
{ startIndex:38, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #6', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script>a</script><script>b</script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:8, type: 'identifier.js' },
{ startIndex:9, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:11, type: getTag('script') },
{ startIndex:17, type: DELIM_END, bracket: Modes.Bracket.Close },
{ startIndex:18, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:19, type: getTag('script') },
{ startIndex:25, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:26, type: 'identifier.js' },
{ startIndex:27, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:29, type: getTag('script') },
{ startIndex:35, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #7', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript"></script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:31, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:33, type: getTag('script') },
{ startIndex:39, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #8', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script>var i= 10;</script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:8, type: 'keyword.js' },
{ startIndex:11, type: '' },
{ startIndex:12, type: 'identifier.js' },
{ startIndex:13, type: 'delimiter.js' },
{ startIndex:14, type: '' },
{ startIndex:15, type: 'number.js' },
{ startIndex:17, type: 'delimiter.js' },
{ startIndex:18, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:20, type: getTag('script') },
{ startIndex:26, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Embedded Content #9', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<script type="text/javascript" src="main.js"></script>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: '' },
{ startIndex:31, type: ATTRIB_NAME },
{ startIndex:34, type: DELIM_ASSIGN },
{ startIndex:35, type: ATTRIB_VALUE },
{ startIndex:44, type: DELIM_START, bracket: Modes.Bracket.Close },
{ startIndex:45, type: DELIM_END, bracket: Modes.Bracket.Open },
{ startIndex:47, type: getTag('script') },
{ startIndex:53, type: DELIM_END, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Attribute', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo="bar">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Empty Attribute Value', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo=\'bar\'>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with empty atrributes', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo="">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:11, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Attributes', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo="bar" bar="foo">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: '' },
{ startIndex:15, type: ATTRIB_NAME },
{ startIndex:18, type: DELIM_ASSIGN },
{ startIndex:19, type: ATTRIB_VALUE },
{ startIndex:24, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Attribute And Whitespace', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo= "bar">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: '' },
{ startIndex:11, type: ATTRIB_VALUE },
{ startIndex:16, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Attribute And Whitespace #2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo = "bar">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:9, type: DELIM_ASSIGN },
{ startIndex:10, type: '' },
{ startIndex:11, type: ATTRIB_VALUE },
{ startIndex:16, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Name-Only-Attribute #1', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Name-Only-Attribute #2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo bar>',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:9, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Invalid Attribute Name', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo!@#="bar">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:13, type: ATTRIB_NAME },
{ startIndex:16, type: '' },
{ startIndex:17, type: DELIM_START, bracket: Modes.Bracket.Close }
]}
]);
});
test('Tag with Invalid Attribute Value', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<abc foo=">',
tokens: [
{ startIndex:0, type: DELIM_START, bracket: Modes.Bracket.Open },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE }
]}
]);
});
test('Simple Comment 1', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!--a-->',
tokens: [
{ startIndex:0, type: DELIM_COMMENT, bracket: Modes.Bracket.Open },
{ startIndex:4, type: COMMENT },
{ startIndex:5, type: DELIM_COMMENT, bracket: Modes.Bracket.Close }
]}
]);
});
test('Simple Comment 2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!--a>foo bar</a -->',
tokens: [
{ startIndex:0, type: DELIM_COMMENT, bracket: Modes.Bracket.Open },
{ startIndex:4, type: COMMENT },
{ startIndex:17, type: DELIM_COMMENT, bracket: Modes.Bracket.Close }
]}
]);
});
test('Multiline Comment', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!--a>\nfoo \nbar</a -->',
tokens: [
{ startIndex:0, type: DELIM_COMMENT, bracket: Modes.Bracket.Open },
{ startIndex:4, type: COMMENT },
{ startIndex:19, type: DELIM_COMMENT, bracket: Modes.Bracket.Close }
]}
]);
});
test('Simple Doctype', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!DOCTYPE a>',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Open },
{ startIndex:9, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Close }
]}
]);
});
test('Simple Doctype #2', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!doctype a>',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Open },
{ startIndex:9, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Close }
]}
]);
});
test('Simple Doctype #4', () => {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '<!DOCTYPE a\n"foo" \'bar\'>',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Open },
{ startIndex:9, type: DOCTYPE },
{ startIndex:23, type: DELIM_DOCTYPE, bracket: Modes.Bracket.Close }
]}
]);
});
test('onEnter', function() {
var model = new Model('<script type=\"text/javascript\">function f() { foo(); }', EditorCommon.DefaultEndOfLine.LF, _mode);
var actual = _mode.richEditSupport.onEnter.onEnter(model, {
lineNumber: 1,
column: 46
});
assert.equal(actual.indentAction, Modes.IndentAction.Indent);
model.dispose();
});
test('onEnter', function() {
function onEnter(line:string, offset:number): Modes.IEnterAction {
let model = new TextModelWithTokens([], TextModel.toRawText(line, EditorCommon.DefaultEndOfLine.LF), false, _mode);
let result = getRawEnterActionAtPosition(model, 1, offset + 1);
model.dispose();
return result;
}
function assertOnEnter(text:string, offset:number, expected: Modes.IndentAction): void {
let _actual = onEnter(text, offset);
let actual = _actual ? _actual.indentAction : null;
let actualStr = actual ? Modes.IndentAction[actual] : null;
let expectedStr = expected ? Modes.IndentAction[expected] : null;
assert.equal(actualStr, expectedStr, 'TEXT: <<' + text + '>>, OFFSET: <<' + offset + '>>');
}
assertOnEnter('', 0, null);
assertOnEnter('>', 1, null);
assertOnEnter('span>', 5, null);
assertOnEnter('</span>', 7, null);
assertOnEnter('<img />', 7, null);
assertOnEnter('<span>', 6, Modes.IndentAction.Indent);
assertOnEnter('<p>', 3, Modes.IndentAction.Indent);
assertOnEnter('<span><span>', 6, Modes.IndentAction.Indent);
assertOnEnter('<p><span>', 3, Modes.IndentAction.Indent);
assertOnEnter('<span></SPan>', 6, Modes.IndentAction.IndentOutdent);
assertOnEnter('<span></span>', 6, Modes.IndentAction.IndentOutdent);
assertOnEnter('<p></p>', 3, Modes.IndentAction.IndentOutdent);
assertOnEnter('<span>a</span>', 6, Modes.IndentAction.Indent);
assertOnEnter('<span>a</span>', 7, Modes.IndentAction.IndentOutdent);
assertOnEnter('<span> </span>', 6, Modes.IndentAction.Indent);
assertOnEnter('<span> </span>', 7, Modes.IndentAction.IndentOutdent);
});
test('matchBracket', () => {
function toString(brackets:EditorCommon.IEditorRange[]): string[] {
if (!brackets) {
return null;
}
brackets.sort(Range.compareRangesUsingStarts);
return brackets.map(b => b.toString());
}
function assertBracket(lines:string[], lineNumber:number, column:number, expected:EditorCommon.IEditorRange[]): void {
let model = new TextModelWithTokens([], TextModel.toRawText(lines.join('\n'), EditorCommon.DefaultEndOfLine.LF), false, _mode);
// force tokenization
model.getLineContext(model.getLineCount());
let actual = model.matchBracket({
lineNumber: lineNumber,
column: column
});
let actualStr = actual ? toString(actual.brackets) : null;
let expectedStr = toString(expected);
assert.deepEqual(actualStr, expectedStr, 'TEXT <<' + lines.join('\n') + '>>, POS: ' + lineNumber + ', ' + column);
}
assertBracket(['<p></p>'], 1, 1, [new Range(1, 1, 1, 2), new Range(1, 3, 1, 4)]);
assertBracket(['<p></p>'], 1, 2, [new Range(1, 1, 1, 2), new Range(1, 3, 1, 4)]);
assertBracket(['<p></p>'], 1, 3, [new Range(1, 1, 1, 2), new Range(1, 3, 1, 4)]);
assertBracket(['<p></p>'], 1, 4, [new Range(1, 1, 1, 2), new Range(1, 3, 1, 4)]);
assertBracket(['<p></p>'], 1, 5, [new Range(1, 4, 1, 5), new Range(1, 7, 1, 8)]);
assertBracket(['<p></p>'], 1, 6, null);
assertBracket(['<p></p>'], 1, 7, [new Range(1, 4, 1, 5), new Range(1, 7, 1, 8)]);
assertBracket(['<p></p>'], 1, 8, [new Range(1, 4, 1, 5), new Range(1, 7, 1, 8)]);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 10, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 11, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 22, null);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 23, null);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 33, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a[a<script>a]a'], 1, 34, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 10, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 11, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 22, null);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 23, null);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 33, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
assertBracket(['<script>a[a</script>a]a<script>a]a'], 1, 34, [new Range(1, 10, 1, 11), new Range(1, 33, 1, 34)]);
});
});
| src/vs/languages/html/test/common/html.test.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0005217175930738449,
0.0001756817364366725,
0.0001652569480938837,
0.00017067394219338894,
0.000041463554225629196
] |
{
"id": 0,
"code_window": [
"{\n",
"\t\"account\": \"monacobuild\",\n",
"\t\"container\": \"debuggers\",\n",
"\t\"zip\": \"add5842/node-debug.zip\",\n",
"\t\"output\": \"\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"zip\": \"4271a18/node-debug.zip\",\n"
],
"file_path": "extensions/node-debug/node-debug.azure.json",
"type": "replace",
"edit_start_line_idx": 3
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import URI from 'vs/base/common/uri';
import {isUnspecific, guessMimeTypes, MIME_TEXT, suggestFilename} from 'vs/base/common/mime';
import labels = require('vs/base/common/labels');
import paths = require('vs/base/common/paths');
import {UntitledEditorInput as AbstractUntitledEditorInput, EditorModel, EncodingMode, IInputStatus} from 'vs/workbench/common/editor';
import {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IModeService} from 'vs/editor/common/services/modeService';
/**
* An editor input to be used for untitled text buffers.
*/
export class UntitledEditorInput extends AbstractUntitledEditorInput {
public static ID: string = 'workbench.editors.untitledEditorInput';
public static SCHEMA: string = 'untitled';
private resource: URI;
private hasAssociatedFilePath: boolean;
private modeId: string;
private cachedModel: UntitledEditorModel;
constructor(
resource: URI,
hasAssociatedFilePath: boolean,
modeId: string,
@IInstantiationService private instantiationService: IInstantiationService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IModeService private modeService: IModeService
) {
super();
this.resource = resource;
this.hasAssociatedFilePath = hasAssociatedFilePath;
this.modeId = modeId;
}
public getId(): string {
return UntitledEditorInput.ID;
}
public getResource(): URI {
return this.resource;
}
public getName(): string {
return this.hasAssociatedFilePath ? paths.basename(this.resource.fsPath) : this.resource.fsPath;
}
public getDescription(): string {
return this.hasAssociatedFilePath ? labels.getPathLabel(paths.dirname(this.resource.fsPath), this.contextService) : null;
}
public isDirty(): boolean {
return this.cachedModel && this.cachedModel.isDirty();
}
public getStatus(): IInputStatus {
let isDirty = this.isDirty();
if (isDirty) {
return { state: 'dirty', decoration: '\u25cf' };
}
return null;
}
public suggestFileName(): string {
if (!this.hasAssociatedFilePath) {
let mime = this.getMime();
if (mime && mime !== MIME_TEXT /* do not suggest when the mime type is simple plain text */) {
return suggestFilename(mime, this.getName());
}
}
return this.getName();
}
public getMime(): string {
if (this.cachedModel) {
return this.modeService.getMimeForMode(this.cachedModel.getModeId());
}
return null;
}
public getEncoding(): string {
if (this.cachedModel) {
return this.cachedModel.getEncoding();
}
return null;
}
public setEncoding(encoding: string, mode: EncodingMode /* ignored, we only have Encode */): void {
if (this.cachedModel) {
this.cachedModel.setEncoding(encoding);
}
}
public resolve(refresh?: boolean): TPromise<EditorModel> {
// Use Cached Model
if (this.cachedModel) {
return TPromise.as(this.cachedModel);
}
// Otherwise Create Model and load
let model = this.createModel();
return model.load().then((resolvedModel: UntitledEditorModel) => {
this.cachedModel = resolvedModel;
return this.cachedModel;
});
}
private createModel(): UntitledEditorModel {
let content = '';
let mime = this.modeId;
if (!mime && this.hasAssociatedFilePath) {
let mimeFromPath = guessMimeTypes(this.resource.fsPath)[0];
if (!isUnspecific(mimeFromPath)) {
mime = mimeFromPath; // take most specific mime type if file path is associated and mime is specific
}
}
return this.instantiationService.createInstance(UntitledEditorModel, content, mime || MIME_TEXT,
this.resource, this.hasAssociatedFilePath);
}
public matches(otherInput: any): boolean {
if (super.matches(otherInput) === true) {
return true;
}
if (otherInput instanceof UntitledEditorInput) {
let otherUntitledEditorInput = <UntitledEditorInput>otherInput;
// Otherwise compare by properties
return otherUntitledEditorInput.resource.toString() === this.resource.toString();
}
return false;
}
public dispose(): void {
super.dispose();
if (this.cachedModel) {
this.cachedModel.dispose();
this.cachedModel = null;
}
}
} | src/vs/workbench/common/editor/untitledEditorInput.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017983395082410425,
0.00017203263996634632,
0.0001678323606029153,
0.00017120596021413803,
0.000002990720759044052
] |
{
"id": 0,
"code_window": [
"{\n",
"\t\"account\": \"monacobuild\",\n",
"\t\"container\": \"debuggers\",\n",
"\t\"zip\": \"add5842/node-debug.zip\",\n",
"\t\"output\": \"\"\n",
"}"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
],
"after_edit": [
"\t\"zip\": \"4271a18/node-debug.zip\",\n"
],
"file_path": "extensions/node-debug/node-debug.azure.json",
"type": "replace",
"edit_start_line_idx": 3
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import nls = require('vs/nls');
import filters = require('vs/base/common/filters');
import winjs = require('vs/base/common/winjs.base');
import severity from 'vs/base/common/severity';
import git = require('vs/workbench/parts/git/common/git');
import quickopenwb = require('vs/workbench/browser/quickopen');
import quickopen = require('vs/base/parts/quickopen/common/quickOpen');
import model = require('vs/base/parts/quickopen/browser/quickOpenModel');
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IMessageService} from 'vs/platform/message/common/message';
import IGitService = git.IGitService;
// Entries
class AbstractRefEntry extends model.QuickOpenEntry {
protected gitService: git.IGitService;
protected messageService: IMessageService;
protected head: git.IBranch;
constructor(gitService: git.IGitService, messageService: IMessageService, head: git.IBranch, highlights:model.IHighlight[]) {
super(highlights);
this.gitService = gitService;
this.messageService = messageService;
this.head = head;
}
public getIcon(): string { return 'git'; }
public getLabel(): string { return this.head.name; }
public getDescription(): string { return ''; }
public getAriaLabel(): string { return nls.localize('refAriaLabel', "{0}, git", this.getLabel()); }
public run(mode: quickopen.Mode, context: model.IContext):boolean {
if (mode === quickopen.Mode.PREVIEW) {
return false;
}
return true;
}
}
class CheckoutHeadEntry extends AbstractRefEntry {
public getDescription(): string { return nls.localize('checkoutBranch', "Branch at {0}", this.head.commit.substr(0, 8)); }
public run(mode: quickopen.Mode, context: model.IContext): boolean {
if (mode === quickopen.Mode.PREVIEW) {
return false;
}
this.gitService.checkout(this.head.name).done(null, e => this.messageService.show(severity.Error, e));
return true;
}
}
class CheckoutTagEntry extends AbstractRefEntry {
public getDescription(): string { return nls.localize('checkoutTag', "Tag at {0}", this.head.commit.substr(0, 8)); }
public run(mode: quickopen.Mode, context: model.IContext): boolean {
if (mode === quickopen.Mode.PREVIEW) {
return false;
}
this.gitService.checkout(this.head.name).done(null, e => this.messageService.show(severity.Error, e));
return true;
}
}
class CurrentHeadEntry extends AbstractRefEntry {
public getDescription(): string { return nls.localize('alreadyCheckedOut', "Branch {0} is already the current branch", this.head.name); }
}
class BranchEntry extends model.QuickOpenEntry {
private gitService: git.IGitService;
private messageService: IMessageService;
private name: string;
constructor(gitService: git.IGitService, messageService: IMessageService, name: string) {
super([{ start: 0, end: name.length }]);
this.gitService = gitService;
this.messageService = messageService;
this.name = name;
}
public getIcon(): string { return 'git'; }
public getLabel(): string { return this.name; }
public getAriaLabel(): string { return nls.localize('branchAriaLabel', "{0}, git branch", this.getLabel()); }
public getDescription(): string { return nls.localize('createBranch', "Create branch {0}", this.name); }
public run(mode: quickopen.Mode, context: model.IContext):boolean {
if (mode === quickopen.Mode.PREVIEW) {
return false;
}
this.gitService.branch(this.name, true).done(null, e => this.messageService.show(severity.Error, e));
return true;
}
}
// Commands
class CheckoutCommand implements quickopenwb.ICommand {
public aliases = ['checkout', 'co'];
public icon = 'git';
constructor(private gitService: git.IGitService, private messageService: IMessageService) {
// noop
}
public getResults(input: string): winjs.TPromise<model.QuickOpenEntry[]> {
input = input.trim();
var gitModel = this.gitService.getModel();
var currentHead = gitModel.getHEAD();
var headMatches = gitModel.getHeads()
.map(head => ({ head, highlights: filters.matchesContiguousSubString(input, head.name) }))
.filter(({ highlights }) => !!highlights);
var headEntries: model.QuickOpenEntry[] = headMatches
.filter(({ head }) => head.name !== currentHead.name)
.map(({ head, highlights }) => new CheckoutHeadEntry(this.gitService, this.messageService, head, highlights));
var tagMatches = gitModel.getTags()
.map(tag => ({ tag, highlights: filters.matchesContiguousSubString(input, tag.name) }))
.filter(({ highlights }) => !!highlights);
var tagEntries: model.QuickOpenEntry[] = tagMatches
.filter(({ tag }) => tag.name !== currentHead.name)
.map(({ tag, highlights }) => new CheckoutTagEntry(this.gitService, this.messageService, tag, highlights));
var entries = headEntries
.concat(tagEntries)
.sort((a, b) => a.getLabel().localeCompare(b.getLabel()));
if (entries.length > 0) {
entries[0] = new model.QuickOpenEntryGroup(entries[0], 'checkout', false);
}
var exactMatches = headMatches.filter(({ head }) => head.name === input);
var currentHeadMatches = exactMatches.filter(({ head }) => head.name === currentHead.name);
if (currentHeadMatches.length > 0) {
entries.unshift(new CurrentHeadEntry(this.gitService, this.messageService, currentHeadMatches[0].head, currentHeadMatches[0].highlights));
} else if (exactMatches.length === 0 && git.isValidBranchName(input)) {
var branchEntry = new BranchEntry(this.gitService, this.messageService, input);
entries.push(new model.QuickOpenEntryGroup(branchEntry, 'branch', false));
}
return winjs.TPromise.as<model.QuickOpenEntry[]>(entries);
}
public getEmptyLabel(input: string): string {
return nls.localize('noBranches', "No other branches");
}
}
class BranchCommand implements quickopenwb.ICommand {
public aliases = ['branch'];
public icon = 'git';
constructor(private gitService: git.IGitService, private messageService: IMessageService) {
// noop
}
public getResults(input: string): winjs.TPromise<model.QuickOpenEntry[]> {
input = input.trim();
if (!git.isValidBranchName(input)) {
return winjs.TPromise.as([]);
}
var gitModel = this.gitService.getModel();
var currentHead = gitModel.getHEAD();
var matches = gitModel.getHeads()
.map(head => ({ head, highlights: filters.matchesContiguousSubString(input, head.name) }))
.filter(({ highlights }) => !!highlights);
var exactMatches = matches.filter(({ head }) => head.name === input);
var headMatches = exactMatches.filter(({ head }) => head.name === currentHead.name);
if (headMatches.length > 0) {
return winjs.TPromise.as([new CurrentHeadEntry(this.gitService, this.messageService, headMatches[0].head, headMatches[0].highlights)]);
} else if (exactMatches.length > 0) {
return winjs.TPromise.as([new CheckoutHeadEntry(this.gitService, this.messageService, exactMatches[0].head, exactMatches[0].highlights)]);
}
var branchEntry = new BranchEntry(this.gitService, this.messageService, input);
return winjs.TPromise.as([new model.QuickOpenEntryGroup(branchEntry, 'branch', false)]);
}
public getEmptyLabel(input: string): string {
return nls.localize('notValidBranchName', "Please provide a valid branch name");
}
}
export class CommandQuickOpenHandler extends quickopenwb.CommandQuickOpenHandler {
constructor(@IQuickOpenService quickOpenService: IQuickOpenService, @IGitService gitService: IGitService, @IMessageService messageService: IMessageService) {
super(quickOpenService, {
prefix: 'git',
commands: [
new CheckoutCommand(gitService, messageService),
new BranchCommand(gitService, messageService)
]
});
}
}
| src/vs/workbench/parts/git/browser/gitQuickOpen.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017801225476432592,
0.00017251446843147278,
0.0001674765080679208,
0.00017216116248164326,
0.0000024446912902931217
] |
{
"id": 1,
"code_window": [
" \"resolved\": \"https://registry.npmjs.org/semver/-/semver-4.3.6.tgz\"\n",
" },\n",
" \"vscode-debugprotocol\": {\n",
" \"version\": \"1.5.0\",\n",
" \"from\": \"vscode-debugprotocol@>=1.5.0\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.5.0.tgz\"\n",
" },\n",
" \"vscode-textmate\": {\n",
" \"version\": \"1.0.11\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"version\": \"1.6.1\",\n",
" \"from\": \"vscode-debugprotocol@>=1.6.1\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.6.1.tgz\"\n"
],
"file_path": "npm-shrinkwrap.json",
"type": "replace",
"edit_start_line_idx": 418
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol
*/
declare module DebugProtocol {
/** Base class of requests, responses, and events. */
export interface ProtocolMessage {
/** Sequence number */
seq: number;
/** One of "request", "response", or "event" */
type: string;
}
/** Client-initiated request */
export interface Request extends ProtocolMessage {
/** The command to execute */
command: string;
/** Object containing arguments for the command */
arguments?: any;
}
/** Server-initiated event */
export interface Event extends ProtocolMessage {
/** Type of event */
event: string;
/** Event-specific information */
body?: any;
}
/** Server-initiated response to client request */
export interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request */
request_seq: number;
/** Outcome of the request */
success: boolean;
/** The command requested */
command: string;
/** Contains error message if success == false. */
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
//---- Events
/** Event message for "initialized" event type.
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
A debug adapter is expected to send this event when it is ready to accept configuration requests.
The sequence of events/requests is as follows:
- adapters sends InitializedEvent (at any time)
- frontend sends zero or more SetBreakpointsRequest
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
- frontend sends other configuration requests that are added in the future
- frontend sends one ConfigurationDoneRequest
*/
export interface InitializedEvent extends Event {
}
/** Event message for "stopped" event type.
The event indicates that the execution of the debugee has stopped due to a break condition.
This can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.
*/
export interface StoppedEvent extends Event {
body: {
/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */
reason: string;
/** The thread which was stopped. */
threadId?: number;
/** Additional information. E.g. if reason is 'exception', text contains the exception name. */
text?: string;
};
}
/** Event message for "exited" event type.
The event indicates that the debugee has exited.
*/
export interface ExitedEvent extends Event {
body: {
/** The exit code returned from the debuggee. */
exitCode: number;
};
}
/** Event message for "terminated" event types.
The event indicates that debugging of the debuggee has terminated.
*/
export interface TerminatedEvent extends Event {
body?: {
/** A debug adapter may set 'restart' to true to request that the front end restarts the session. */
restart?: boolean;
}
}
/** Event message for "thread" event type.
The event indicates that a thread has started or exited.
*/
export interface ThreadEvent extends Event {
body: {
/** The reason for the event (such as: 'started', 'exited'). */
reason: string;
/** The identifier of the thread. */
threadId: number;
};
}
/** Event message for "output" event type.
The event indicates that the target has produced output.
*/
export interface OutputEvent extends Event {
body: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category?: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
}
/** Event message for "breakpoint" event type.
The event indicates that some information about a breakpoint has changed.
*/
export interface BreakpointEvent extends Event {
body: {
/** The reason for the event (such as: 'changed', 'new'). */
reason: string;
/** The breakpoint. */
breakpoint: Breakpoint;
}
}
//---- Requests
/** On error that is whenever 'success' is false, the body can provide more details.
*/
export interface ErrorResponse extends Response {
body: {
/** An optional, structured error message. */
error?: Message
}
}
/** Initialize request; value of command field is "initialize".
*/
export interface InitializeRequest extends Request {
arguments: InitializeRequestArguments;
}
/** Arguments for "initialize" request. */
export interface InitializeRequestArguments {
/** The ID of the debugger adapter. Used to select or verify debugger adapter. */
adapterID: string;
/** If true all line numbers are 1-based (default). */
linesStartAt1?: boolean;
/** If true all column numbers are 1-based (default). */
columnsStartAt1?: boolean;
/** Determines in what format paths are specified. Possible values are 'path' or 'uri'. The default is 'path', which is the native format. */
pathFormat?: string;
}
/** Response to Initialize request. */
export interface InitializeResponse extends Response {
/** The capabilities of this debug adapter */
body?: Capabilites;
}
/** ConfigurationDone request; value of command field is "configurationDone".
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
*/
export interface ConfigurationDoneRequest extends Request {
arguments?: ConfigurationDoneArguments;
}
/** Arguments for "configurationDone" request. */
export interface ConfigurationDoneArguments {
/* The configurationDone request has no standardized attributes. */
}
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
export interface ConfigurationDoneResponse extends Response {
}
/** Launch request; value of command field is "launch".
*/
export interface LaunchRequest extends Request {
arguments: LaunchRequestArguments;
}
/** Arguments for "launch" request. */
export interface LaunchRequestArguments {
/* The launch request has no standardized attributes. */
}
/** Response to "launch" request. This is just an acknowledgement, so no body field is required. */
export interface LaunchResponse extends Response {
}
/** Attach request; value of command field is "attach".
*/
export interface AttachRequest extends Request {
arguments: AttachRequestArguments;
}
/** Arguments for "attach" request. */
export interface AttachRequestArguments {
/* The attach request has no standardized attributes. */
}
/** Response to "attach" request. This is just an acknowledgement, so no body field is required. */
export interface AttachResponse extends Response {
}
/** Disconnect request; value of command field is "disconnect".
*/
export interface DisconnectRequest extends Request {
arguments?: DisconnectArguments;
}
/** Arguments for "disconnect" request. */
export interface DisconnectArguments {
}
/** Response to "disconnect" request. This is just an acknowledgement, so no body field is required. */
export interface DisconnectResponse extends Response {
}
/** SetBreakpoints request; value of command field is "setBreakpoints".
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
To clear all breakpoint for a source, specify an empty array.
When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
*/
export interface SetBreakpointsRequest extends Request {
arguments: SetBreakpointsArguments;
}
/** Arguments for "setBreakpoints" request. */
export interface SetBreakpointsArguments {
/** The source location of the breakpoints; either source.path or source.reference must be specified. */
source: Source;
/** The code locations of the breakpoints. */
breakpoints?: SourceBreakpoint[];
/** Deprecated: The code locations of the breakpoints. */
lines?: number[];
}
/** Response to "setBreakpoints" request.
Returned is information about each breakpoint created by this request.
This includes the actual code location and whether the breakpoint could be verified.
*/
export interface SetBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */
breakpoints: Breakpoint[];
};
}
/** SetFunctionBreakpoints request; value of command field is "setFunctionBreakpoints".
Sets multiple function breakpoints and clears all previous function breakpoints.
To clear all function breakpoint, specify an empty array.
When a function breakpoint is hit, a StoppedEvent (event type 'function breakpoint') is generated.
*/
export interface SetFunctionBreakpointsRequest extends Request {
arguments: SetFunctionBreakpointsArguments;
}
/** Arguments for "setFunctionBreakpoints" request. */
export interface SetFunctionBreakpointsArguments {
/** The function names of the breakpoints. */
breakpoints: FunctionBreakpoint[];
}
/** Response to "setFunctionBreakpoints" request.
Returned is information about each breakpoint created by this request.
*/
export interface SetFunctionBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
breakpoints: Breakpoint[];
};
}
/** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
*/
export interface SetExceptionBreakpointsRequest extends Request {
arguments: SetExceptionBreakpointsArguments;
}
/** Arguments for "setExceptionBreakpoints" request. */
export interface SetExceptionBreakpointsArguments {
/** Names of enabled exception breakpoints. */
filters: string[];
}
/** Response to "setExceptionBreakpoints" request. This is just an acknowledgement, so no body field is required. */
export interface SetExceptionBreakpointsResponse extends Response {
}
/** Continue request; value of command field is "continue".
The request starts the debuggee to run again.
*/
export interface ContinueRequest extends Request {
arguments: ContinueArguments;
}
/** Arguments for "continue" request. */
export interface ContinueArguments {
/** continue execution for this thread. */
threadId: number;
}
/** Response to "continue" request. This is just an acknowledgement, so no body field is required. */
export interface ContinueResponse extends Response {
}
/** Next request; value of command field is "next".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface NextRequest extends Request {
arguments: NextArguments;
}
/** Arguments for "next" request. */
export interface NextArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "next" request. This is just an acknowledgement, so no body field is required. */
export interface NextResponse extends Response {
}
/** StepIn request; value of command field is "stepIn".
The request starts the debuggee to run again for one step.
The debug adapter will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepInRequest extends Request {
arguments: StepInArguments;
}
/** Arguments for "stepIn" request. */
export interface StepInArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepIn" request. This is just an acknowledgement, so no body field is required. */
export interface StepInResponse extends Response {
}
/** StepOutIn request; value of command field is "stepOut".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepOutRequest extends Request {
arguments: StepOutArguments;
}
/** Arguments for "stepOut" request. */
export interface StepOutArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepOut" request. This is just an acknowledgement, so no body field is required. */
export interface StepOutResponse extends Response {
}
/** Pause request; value of command field is "pause".
The request suspenses the debuggee.
penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command.
*/
export interface PauseRequest extends Request {
arguments: PauseArguments;
}
/** Arguments for "pause" request. */
export interface PauseArguments {
/** Pause execution for this thread. */
threadId: number;
}
/** Response to "pause" request. This is just an acknowledgement, so no body field is required. */
export interface PauseResponse extends Response {
}
/** StackTrace request; value of command field is "stackTrace".
The request returns a stacktrace from the current execution state.
*/
export interface StackTraceRequest extends Request {
arguments: StackTraceArguments;
}
/** Arguments for "stackTrace" request. */
export interface StackTraceArguments {
/** Retrieve the stacktrace for this thread. */
threadId: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
}
/** Response to "stackTrace" request. */
export interface StackTraceResponse extends Response {
body: {
/** The frames of the stackframe. If the array has length zero, there are no stackframes available.
This means that there is no location information available. */
stackFrames: StackFrame[];
};
}
/** Scopes request; value of command field is "scopes".
The request returns the variable scopes for a given stackframe ID.
*/
export interface ScopesRequest extends Request {
arguments: ScopesArguments;
}
/** Arguments for "scopes" request. */
export interface ScopesArguments {
/** Retrieve the scopes for this stackframe. */
frameId: number;
}
/** Response to "scopes" request. */
export interface ScopesResponse extends Response {
body: {
/** The scopes of the stackframe. If the array has length zero, there are no scopes available. */
scopes: Scope[];
};
}
/** Variables request; value of command field is "variables".
Retrieves all children for the given variable reference.
*/
export interface VariablesRequest extends Request {
arguments: VariablesArguments;
}
/** Arguments for "variables" request. */
export interface VariablesArguments {
/** The Variable reference. */
variablesReference: number;
}
/** Response to "variables" request. */
export interface VariablesResponse extends Response {
body: {
/** All children for the given variable reference */
variables: Variable[];
};
}
/** Source request; value of command field is "source".
The request retrieves the source code for a given source reference.
*/
export interface SourceRequest extends Request {
arguments: SourceArguments;
}
/** Arguments for "source" request. */
export interface SourceArguments {
/** The reference to the source. This is the value received in Source.reference. */
sourceReference: number;
}
/** Response to "source" request. */
export interface SourceResponse extends Response {
body: {
/** Content of the source reference */
content: string;
};
}
/** Thread request; value of command field is "threads".
The request retrieves a list of all threads.
*/
export interface ThreadsRequest extends Request {
}
/** Response to "threads" request. */
export interface ThreadsResponse extends Response {
body: {
/** All threads. */
threads: Thread[];
};
}
/** Evaluate request; value of command field is "evaluate".
Evaluates the given expression in the context of the top most stack frame.
The expression has access to any variables and arguments that are in scope.
*/
export interface EvaluateRequest extends Request {
arguments: EvaluateArguments;
}
/** Arguments for "evaluate" request. */
export interface EvaluateArguments {
/** The expression to evaluate. */
expression: string;
/** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
}
/** Response to "evaluate" request. */
export interface EvaluateResponse extends Response {
body: {
/** The result of the evaluate. */
result: string;
/** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest */
variablesReference: number;
};
}
//---- Types
/** Information about the capabilities of a debug adapter. */
export interface Capabilites {
/** The debug adapter supports the configurationDoneRequest. */
supportsConfigurationDoneRequest?: boolean;
/** The debug adapter supports functionBreakpoints. */
supportsFunctionBreakpoints?: boolean;
/** The debug adapter supports conditionalBreakpoints. */
supportsConditionalBreakpoints?: boolean;
/** The debug adapter supports a (side effect free) evaluate request for data hovers. */
supportsEvaluateForHovers?: boolean;
/** Available filters for the setExceptionBreakpoints request. */
exceptionBreakpointFilters?: [
{
filter: string,
label: string
}
]
}
/** A structured message object. Used to return errors from requests. */
export interface Message {
/** Unique identifier for the message. */
id: number;
/** A format string for the message. Embedded variables have the form '{name}'.
If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. */
format: string;
/** An object used as a dictionary for looking up the variables in the format string. */
variables?: { [key: string]: string };
/** if true send to telemetry */
sendTelemetry?: boolean;
/** if true show user */
showUser?: boolean;
}
/** A Thread */
export interface Thread {
/** Unique identifier for the thread. */
id: number;
/** A name of the thread. */
name: string;
}
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
/** The long (absolute) path of the source. It is not guaranteed that the source exists at this location. */
path?: string;
/** If sourceReference > 0 the contents of the source can be retrieved through the SourceRequest. A sourceReference is only valid for a session, so it must not be used to persist a source. */
sourceReference?: number;
/** The (optional) origin of this source: possible values "internal module", "inlined content from source map", etc. */
origin?: string;
/** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */
adapterData?: any;
}
/** A Stackframe contains the source location. */
export interface StackFrame {
/** An identifier for the stack frame. This id can be used to retrieve the scopes of the frame with the 'scopesRequest'. */
id: number;
/** The name of the stack frame, typically a method name */
name: string;
/** The optional source of the frame. */
source?: Source;
/** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */
line: number;
/** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */
column: number;
}
/** A Scope is a named container for variables. */
export interface Scope {
/** name of the scope (as such 'Arguments', 'Locals') */
name: string;
/** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */
variablesReference: number;
/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
/** A Variable is a name/value pair.
If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest.
*/
export interface Variable {
/** The variable's name */
name: string;
/** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
value: string;
/** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
variablesReference: number;
}
/** Properties of a breakpoint passed to the setBreakpoints request.
*/
export interface SourceBreakpoint {
/** The source line of the breakpoint. */
line: number;
/** An optional source column of the breakpoint. */
column?: number;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Properties of a breakpoint passed to the setFunctionBreakpoints request.
*/
export interface FunctionBreakpoint {
/** The name of the function. */
name: string;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.
*/
export interface Breakpoint {
/** An optional unique identifier for the breakpoint. */
id?: number;
/** If true breakpoint could be set (but not necessarily at the desired location). */
verified: boolean;
/** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */
message?: string;
/** The source where the breakpoint is located. */
source?: Source;
/** The actual line of the breakpoint. */
line?: number;
/** The actual column of the breakpoint. */
column?: number;
}
}
| src/vs/workbench/parts/debug/common/debugProtocol.d.ts | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00023938539379741997,
0.00017105662846006453,
0.00016089399287011474,
0.00016938764019869268,
0.000009963627235265449
] |
{
"id": 1,
"code_window": [
" \"resolved\": \"https://registry.npmjs.org/semver/-/semver-4.3.6.tgz\"\n",
" },\n",
" \"vscode-debugprotocol\": {\n",
" \"version\": \"1.5.0\",\n",
" \"from\": \"vscode-debugprotocol@>=1.5.0\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.5.0.tgz\"\n",
" },\n",
" \"vscode-textmate\": {\n",
" \"version\": \"1.0.11\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"version\": \"1.6.1\",\n",
" \"from\": \"vscode-debugprotocol@>=1.6.1\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.6.1.tgz\"\n"
],
"file_path": "npm-shrinkwrap.json",
"type": "replace",
"edit_start_line_idx": 418
} | // Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",
// we want to run npm
"command": "npm",
// the command is a shell script
"isShellCommand": true,
// show the output window only if unrecognized errors occur.
"showOutput": "silent",
// we run the custom script "compile" as defined in package.json
"args": ["run", "vscode:prepublish"],
// The tsc compiler is started in watching mode
"isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
} | extensions/json/.vscode/tasks.json | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017086805019062012,
0.00016599803348071873,
0.00016240002878475934,
0.00016536199836991727,
0.0000034794281873473665
] |
{
"id": 1,
"code_window": [
" \"resolved\": \"https://registry.npmjs.org/semver/-/semver-4.3.6.tgz\"\n",
" },\n",
" \"vscode-debugprotocol\": {\n",
" \"version\": \"1.5.0\",\n",
" \"from\": \"vscode-debugprotocol@>=1.5.0\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.5.0.tgz\"\n",
" },\n",
" \"vscode-textmate\": {\n",
" \"version\": \"1.0.11\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"version\": \"1.6.1\",\n",
" \"from\": \"vscode-debugprotocol@>=1.6.1\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.6.1.tgz\"\n"
],
"file_path": "npm-shrinkwrap.json",
"type": "replace",
"edit_start_line_idx": 418
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import timer = require('vs/base/common/timer');
import paths = require('vs/base/common/paths');
import {Action} from 'vs/base/common/actions';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import nls = require('vs/nls');
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ipcRenderer as ipc, webFrame, remote} from 'electron';
export class CloseEditorAction extends Action {
public static ID = 'workbench.action.closeActiveEditor';
public static LABEL = nls.localize('closeActiveEditor', "Close Editor");
constructor(
id: string,
label: string,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
public run(): TPromise<any> {
let activeEditor = this.editorService.getActiveEditor();
if (activeEditor) {
return this.editorService.closeEditor(activeEditor);
}
this.windowService.getWindow().close();
return TPromise.as(false);
}
}
export class CloseWindowAction extends Action {
public static ID = 'workbench.action.closeWindow';
public static LABEL = nls.localize('closeWindow', "Close Window");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
super(id, label);
}
public run(): TPromise<boolean> {
this.windowService.getWindow().close();
return TPromise.as(true);
}
}
export class CloseFolderAction extends Action {
public static ID = 'workbench.action.closeFolder';
public static LABEL = nls.localize('closeFolder', "Close Folder");
constructor(
id: string,
label: string,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IMessageService private messageService: IMessageService,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
public run(): TPromise<boolean> {
if (this.contextService.getWorkspace()) {
ipc.send('vscode:closeFolder', this.windowService.getWindowId()); // handled from browser process
} else {
this.messageService.show(Severity.Info, nls.localize('noFolderOpened', "There is currently no folder opened in this instance to close."));
}
return TPromise.as(true);
}
}
export class NewWindowAction extends Action {
public static ID = 'workbench.action.newWindow';
public static LABEL = nls.localize('newWindow', "New Window");
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
public run(): TPromise<boolean> {
this.windowService.getWindow().openNew();
return TPromise.as(true);
}
}
export class ToggleFullScreenAction extends Action {
public static ID = 'workbench.action.toggleFullScreen';
public static LABEL = nls.localize('toggleFullScreen', "Toggle Full Screen");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
super(id, label);
}
public run(): TPromise<boolean> {
ipc.send('vscode:toggleFullScreen', this.windowService.getWindowId());
return TPromise.as(true);
}
}
export class ToggleMenuBarAction extends Action {
public static ID = 'workbench.action.toggleMenuBar';
public static LABEL = nls.localize('toggleMenuBar', "Toggle Menu Bar");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
super(id, label);
}
public run(): TPromise<boolean> {
ipc.send('vscode:toggleMenuBar', this.windowService.getWindowId());
return TPromise.as(true);
}
}
export class ToggleDevToolsAction extends Action {
public static ID = 'workbench.action.toggleDevTools';
public static LABEL = nls.localize('toggleDevTools', "Toggle Developer Tools");
constructor(id: string, label: string) {
super(id, label);
}
public run(): TPromise<boolean> {
remote.getCurrentWindow().webContents.toggleDevTools();
return TPromise.as(true);
}
}
export class ZoomInAction extends Action {
public static ID = 'workbench.action.zoomIn';
public static LABEL = nls.localize('zoomIn', "Zoom in");
constructor(id: string, label: string) {
super(id, label);
}
public run(): TPromise<boolean> {
webFrame.setZoomLevel(webFrame.getZoomLevel() + 1);
return TPromise.as(true);
}
}
export abstract class BaseZoomAction extends Action {
constructor(
id: string,
label: string,
@IConfigurationService private configurationService: IConfigurationService
) {
super(id, label);
}
public run(): TPromise<boolean> {
return TPromise.as(false); // Subclass to implement
}
protected loadConfiguredZoomLevel(): TPromise<number> {
return this.configurationService.loadConfiguration().then((windowConfig: IWindowConfiguration) => {
if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') {
return windowConfig.window.zoomLevel;
}
return 0; // default
});
}
}
export class ZoomOutAction extends BaseZoomAction {
public static ID = 'workbench.action.zoomOut';
public static LABEL = nls.localize('zoomOut', "Zoom out");
constructor(
id: string,
label: string,
@IConfigurationService configurationService: IConfigurationService
) {
super(id, label, configurationService);
}
public run(): TPromise<boolean> {
return this.loadConfiguredZoomLevel().then(level => {
let newZoomLevelCandiate = webFrame.getZoomLevel() - 1;
if (newZoomLevelCandiate < 0 && newZoomLevelCandiate < level) {
newZoomLevelCandiate = Math.min(level, 0); // do not zoom below configured level or below 0
}
webFrame.setZoomLevel(newZoomLevelCandiate);
return true;
});
}
}
export class ZoomResetAction extends BaseZoomAction {
public static ID = 'workbench.action.zoomReset';
public static LABEL = nls.localize('zoomReset', "Reset Zoom");
constructor(
id: string,
label: string,
@IConfigurationService configurationService: IConfigurationService
) {
super(id, label, configurationService);
}
public run(): TPromise<boolean> {
return this.loadConfiguredZoomLevel().then(level => {
webFrame.setZoomLevel(level);
return true;
});
}
}
/* Copied from loader.ts */
enum LoaderEventType {
LoaderAvailable = 1,
BeginLoadingScript = 10,
EndLoadingScriptOK = 11,
EndLoadingScriptError = 12,
BeginInvokeFactory = 21,
EndInvokeFactory = 22,
NodeBeginEvaluatingScript = 31,
NodeEndEvaluatingScript = 32,
NodeBeginNativeRequire = 33,
NodeEndNativeRequire = 34
}
interface ILoaderEvent {
type: LoaderEventType;
timestamp: number;
detail: string;
}
export class ShowStartupPerformance extends Action {
public static ID = 'workbench.action.appPerf';
public static LABEL = nls.localize('appPerf', "Startup Performance");
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
) {
super(id, label);
this.enabled = contextService.getConfiguration().env.enablePerformance;
}
private _analyzeLoaderTimes(): any[] {
let stats = <ILoaderEvent[]>(<any>require).getStats();
let result = [];
let total = 0;
for (let i = 0, len = stats.length; i < len; i++) {
if (stats[i].type === LoaderEventType.NodeEndNativeRequire) {
if (stats[i - 1].type === LoaderEventType.NodeBeginNativeRequire && stats[i - 1].detail === stats[i].detail) {
let entry: any = {};
entry['Event'] = 'nodeRequire ' + stats[i].detail;
entry['Took (ms)'] = (stats[i].timestamp - stats[i - 1].timestamp);
total += (stats[i].timestamp - stats[i - 1].timestamp);
entry['Start (ms)'] = '**' + stats[i - 1].timestamp;
entry['End (ms)'] = '**' + stats[i - 1].timestamp;
result.push(entry);
}
}
}
if (total > 0) {
let entry: any = {};
entry['Event'] = '===nodeRequire TOTAL';
entry['Took (ms)'] = total;
entry['Start (ms)'] = '**';
entry['End (ms)'] = '**';
result.push(entry);
}
return result;
}
public run(): TPromise<boolean> {
let table: any[] = [];
table.push(...this._analyzeLoaderTimes());
let start = Math.round(remote.getGlobal('programStart') || remote.getGlobal('vscodeStart'));
let windowShowTime = Math.round(remote.getGlobal('windowShow'));
let lastEvent: timer.ITimerEvent;
let events = timer.getTimeKeeper().getCollectedEvents();
events.forEach((e) => {
if (e.topic === 'Startup') {
lastEvent = e;
let entry: any = {};
entry['Event'] = e.name;
entry['Took (ms)'] = e.stopTime.getTime() - e.startTime.getTime();
entry['Start (ms)'] = Math.max(e.startTime.getTime() - start, 0);
entry['End (ms)'] = e.stopTime.getTime() - start;
table.push(entry);
}
});
table.push({ Event: '---------------------------' });
let windowShowEvent: any = {};
windowShowEvent['Event'] = 'Show Window at';
windowShowEvent['Start (ms)'] = windowShowTime - start;
table.push(windowShowEvent);
let sum: any = {};
sum['Event'] = 'Total';
sum['Took (ms)'] = lastEvent.stopTime.getTime() - start;
table.push(sum);
// Show dev tools
this.windowService.getWindow().openDevTools();
// Print to console
setTimeout(() => {
console.warn('Run the action again if you do not see the numbers!');
(<any>console).table(table);
}, 1000);
return TPromise.as(true);
}
}
export class ReloadWindowAction extends Action {
public static ID = 'workbench.action.reloadWindow';
public static LABEL = nls.localize('reloadWindow', "Reload Window");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
super(id, label);
}
public run(): TPromise<boolean> {
this.windowService.getWindow().reload();
return TPromise.as(true);
}
}
export class OpenRecentAction extends Action {
public static ID = 'workbench.action.openRecent';
public static LABEL = nls.localize('openRecent', "Open Recent");
constructor(
id: string,
label: string,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IQuickOpenService private quickOpenService: IQuickOpenService
) {
super(id, label);
}
public run(): TPromise<boolean> {
let picks = this.contextService.getConfiguration().env.recentPaths.map(p => {
return {
label: paths.basename(p),
description: paths.dirname(p),
path: p
};
});
const hasWorkspace = !!this.contextService.getWorkspace();
return this.quickOpenService.pick(picks, {
autoFocus: { autoFocusFirstEntry: !hasWorkspace, autoFocusSecondEntry: hasWorkspace },
placeHolder: nls.localize('openRecentPlaceHolder', "Select a path to open"),
matchOnDescription: true
}).then(p => {
if (p) {
ipc.send('vscode:windowOpen', [p.path]);
}
return true;
});
}
}
export class CloseMessagesAction extends Action {
public static ID = 'workbench.action.closeMessages';
public static LABEL = nls.localize('closeMessages', "Close Notification Messages");
constructor(
id: string,
label: string,
@IMessageService private messageService: IMessageService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super(id, label);
}
public run(): TPromise<boolean> {
// Close any Message if visible
this.messageService.hideAll();
// Restore focus if we got an editor
const editor = this.editorService.getActiveEditor();
if (editor) {
editor.focus();
}
return TPromise.as(true);
}
} | src/vs/workbench/electron-browser/actions.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017444550758227706,
0.00017049143207259476,
0.00016121588123496622,
0.00017127441242337227,
0.0000026562158836895833
] |
{
"id": 1,
"code_window": [
" \"resolved\": \"https://registry.npmjs.org/semver/-/semver-4.3.6.tgz\"\n",
" },\n",
" \"vscode-debugprotocol\": {\n",
" \"version\": \"1.5.0\",\n",
" \"from\": \"vscode-debugprotocol@>=1.5.0\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.5.0.tgz\"\n",
" },\n",
" \"vscode-textmate\": {\n",
" \"version\": \"1.0.11\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"version\": \"1.6.1\",\n",
" \"from\": \"vscode-debugprotocol@>=1.6.1\",\n",
" \"resolved\": \"https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.6.1.tgz\"\n"
],
"file_path": "npm-shrinkwrap.json",
"type": "replace",
"edit_start_line_idx": 418
} | // ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "SublimeText/PowerShell",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/SublimeText/PowerShell"
}]
| extensions/powershell/OSSREADME.json | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0001670535420998931,
0.0001670535420998931,
0.0001670535420998931,
0.0001670535420998931,
0
] |
{
"id": 2,
"code_window": [
" \"https-proxy-agent\": \"^0.3.5\",\n",
" \"iconv-lite\": \"^0.4.13\",\n",
" \"native-keymap\": \"^0.1.2\",\n",
" \"sax\": \"^1.1.1\",\n",
" \"semver\": \"^4.2.0\",\n",
" \"vscode-debugprotocol\": \"^1.5.0\",\n",
" \"vscode-textmate\": \"^1.0.11\",\n",
" \"weak\": \"^1.0.1\",\n",
" \"winreg\": \"0.0.12\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"vscode-debugprotocol\": \"^1.6.1\",\n"
],
"file_path": "package.json",
"type": "replace",
"edit_start_line_idx": 29
} | {
"account": "monacobuild",
"container": "debuggers",
"zip": "add5842/node-debug.zip",
"output": ""
}
| extensions/node-debug/node-debug.azure.json | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00016567851707804948,
0.00016567851707804948,
0.00016567851707804948,
0.00016567851707804948,
0
] |
{
"id": 2,
"code_window": [
" \"https-proxy-agent\": \"^0.3.5\",\n",
" \"iconv-lite\": \"^0.4.13\",\n",
" \"native-keymap\": \"^0.1.2\",\n",
" \"sax\": \"^1.1.1\",\n",
" \"semver\": \"^4.2.0\",\n",
" \"vscode-debugprotocol\": \"^1.5.0\",\n",
" \"vscode-textmate\": \"^1.0.11\",\n",
" \"weak\": \"^1.0.1\",\n",
" \"winreg\": \"0.0.12\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"vscode-debugprotocol\": \"^1.6.1\",\n"
],
"file_path": "package.json",
"type": "replace",
"edit_start_line_idx": 29
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench.vs .textdiff-editor-action.next {
background: url('next-diff.svg') center center no-repeat;
}
.monaco-workbench.vs .textdiff-editor-action.previous {
background: url('previous-diff.svg') center center no-repeat;
}
.monaco-workbench.vs-dark .textdiff-editor-action.next {
background: url('next-diff-inverse.svg') center center no-repeat;
}
.monaco-workbench.vs-dark .textdiff-editor-action.previous {
background: url('previous-diff-inverse.svg') center center no-repeat;
}
/* High Contrast Theming */
.monaco-workbench.hc-black .textdiff-editor-action:before {
position: absolute;
top: 12px;
left: 8px;
height: 16px;
width: 16px;
}
.monaco-workbench.hc-black .textdiff-editor-action.next:before {
content: url('next-diff-inverse.svg');
}
.monaco-workbench.hc-black .textdiff-editor-action.previous:before {
content: url('previous-diff-inverse.svg');
} | src/vs/workbench/browser/parts/editor/media/textdiffeditor.css | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017546779417898506,
0.00017281953478232026,
0.00017152067448478192,
0.00017214484978467226,
0.0000015510621551584336
] |
{
"id": 2,
"code_window": [
" \"https-proxy-agent\": \"^0.3.5\",\n",
" \"iconv-lite\": \"^0.4.13\",\n",
" \"native-keymap\": \"^0.1.2\",\n",
" \"sax\": \"^1.1.1\",\n",
" \"semver\": \"^4.2.0\",\n",
" \"vscode-debugprotocol\": \"^1.5.0\",\n",
" \"vscode-textmate\": \"^1.0.11\",\n",
" \"weak\": \"^1.0.1\",\n",
" \"winreg\": \"0.0.12\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"vscode-debugprotocol\": \"^1.6.1\",\n"
],
"file_path": "package.json",
"type": "replace",
"edit_start_line_idx": 29
} | {
"name": "python",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
"contributes": {
"languages": [{
"id": "python",
"extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi" ],
"aliases": [ "Python", "py" ],
"firstLine": "^#!/.*\\bpython[0-9.-]*\\b",
"configuration": "./python.configuration.json"
}],
"grammars": [{
"language": "python",
"scopeName": "source.python",
"path": "./syntaxes/Python.tmLanguage"
},{
"scopeName": "source.regexp.python",
"path": "./syntaxes/Regular Expressions (Python).tmLanguage"
}]
}
}
| extensions/python/package.json | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017482000112067908,
0.000170659608556889,
0.00016468545072712004,
0.00017247335927095264,
0.000004331632680987241
] |
{
"id": 2,
"code_window": [
" \"https-proxy-agent\": \"^0.3.5\",\n",
" \"iconv-lite\": \"^0.4.13\",\n",
" \"native-keymap\": \"^0.1.2\",\n",
" \"sax\": \"^1.1.1\",\n",
" \"semver\": \"^4.2.0\",\n",
" \"vscode-debugprotocol\": \"^1.5.0\",\n",
" \"vscode-textmate\": \"^1.0.11\",\n",
" \"weak\": \"^1.0.1\",\n",
" \"winreg\": \"0.0.12\",\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
" \"vscode-debugprotocol\": \"^1.6.1\",\n"
],
"file_path": "package.json",
"type": "replace",
"edit_start_line_idx": 29
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IRenderer } from './list';
import { IDisposable } from 'vs/base/common/lifecycle';
import { emmet as $, addClass, removeClass } from 'vs/base/browser/dom';
export interface IRow {
domNode: HTMLElement;
templateId: string;
templateData: any;
}
function getLastScrollTime(element: HTMLElement): number {
var value = element.getAttribute('last-scroll-time');
return value ? parseInt(value, 10) : 0;
}
function removeFromParent(element: HTMLElement): void {
try {
element.parentElement.removeChild(element);
} catch (e) {
// this will throw if this happens due to a blur event, nasty business
}
}
export class RowCache<T> implements IDisposable {
private cache: { [templateId:string]: IRow[]; };
private scrollingRow: IRow;
constructor(private renderers: { [templateId: string]: IRenderer<T, any>; }) {
this.cache = Object.create(null);
this.scrollingRow = null;
}
/**
* Returns a row either by creating a new one or reusing
* a previously released row which shares the same templateId.
*/
alloc(templateId: string): IRow {
let result = this.getTemplateCache(templateId).pop();
if (!result) {
const domNode = $('.monaco-list-row');
const renderer = this.renderers[templateId];
const templateData = renderer.renderTemplate(domNode);
result = { domNode, templateId, templateData };
}
return result;
}
/**
* Releases the row for eventual reuse. The row's domNode
* will eventually be removed from its parent, given that
* it is not the currently scrolling row (for OS X ballistic
* scrolling).
*/
release(row: IRow): void {
var lastScrollTime = getLastScrollTime(row.domNode);
if (!lastScrollTime) {
removeFromParent(row.domNode);
this.getTemplateCache(row.templateId).push(row);
return;
}
if (this.scrollingRow) {
var lastKnownScrollTime = getLastScrollTime(this.scrollingRow.domNode);
if (lastKnownScrollTime > lastScrollTime) {
removeFromParent(row.domNode);
this.getTemplateCache(row.templateId).push(row);
return;
}
if (this.scrollingRow.domNode.parentElement) {
removeFromParent(this.scrollingRow.domNode);
removeClass(this.scrollingRow.domNode, 'scrolling');
this.getTemplateCache(this.scrollingRow.templateId).push(this.scrollingRow);
}
}
this.scrollingRow = row;
addClass(this.scrollingRow.domNode, 'scrolling');
}
private getTemplateCache(templateId: string): IRow[] {
return this.cache[templateId] || (this.cache[templateId] = []);
}
garbageCollect(): void {
if (this.cache) {
Object.keys(this.cache).forEach(templateId => {
this.cache[templateId].forEach(cachedRow => {
const renderer = this.renderers[templateId];
renderer.disposeTemplate(cachedRow.templateData);
cachedRow.domNode = null;
cachedRow.templateData = null;
});
delete this.cache[templateId];
});
}
if (this.scrollingRow) {
const renderer = this.renderers[this.scrollingRow.templateId];
renderer.disposeTemplate(this.scrollingRow.templateData);
this.scrollingRow = null;
}
}
dispose(): void {
this.garbageCollect();
this.cache = null;
this.renderers = null;
}
} | src/vs/base/browser/ui/list/rowCache.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017540706903673708,
0.0001697482366580516,
0.0001605461147846654,
0.00017057878721971065,
0.000003936250777769601
] |
{
"id": 3,
"code_window": [
"\t\tThis event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).\n",
"\t\tA debug adapter is expected to send this event when it is ready to accept configuration requests.\n",
"\t\tThe sequence of events/requests is as follows:\n",
"\t\t- adapters sends InitializedEvent (at any time)\n",
"\t\t- frontend sends zero or more SetBreakpointsRequest\n",
"\t\t- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')\n",
"\t\t- frontend sends other configuration requests that are added in the future\n",
"\t\t- frontend sends one ConfigurationDoneRequest\n",
"\t*/\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t- frontend sends one SetFunctionBreakpointsRequest\n",
"\t\t- frontend sends a SetExceptionBreakpointsRequest if one or more exceptionBreakpointFilters have been defined (or if supportsConfigurationDoneRequest is not defined or false)\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 55
} | {
"account": "monacobuild",
"container": "debuggers",
"zip": "add5842/node-debug.zip",
"output": ""
}
| extensions/node-debug/node-debug.azure.json | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00016706644964870065,
0.00016706644964870065,
0.00016706644964870065,
0.00016706644964870065,
0
] |
{
"id": 3,
"code_window": [
"\t\tThis event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).\n",
"\t\tA debug adapter is expected to send this event when it is ready to accept configuration requests.\n",
"\t\tThe sequence of events/requests is as follows:\n",
"\t\t- adapters sends InitializedEvent (at any time)\n",
"\t\t- frontend sends zero or more SetBreakpointsRequest\n",
"\t\t- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')\n",
"\t\t- frontend sends other configuration requests that are added in the future\n",
"\t\t- frontend sends one ConfigurationDoneRequest\n",
"\t*/\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t- frontend sends one SetFunctionBreakpointsRequest\n",
"\t\t- frontend sends a SetExceptionBreakpointsRequest if one or more exceptionBreakpointFilters have been defined (or if supportsConfigurationDoneRequest is not defined or false)\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 55
} | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle cx="8" cy="8" r="6" fill="#F6F6F6"/><path d="M8 3C5.238 3 3 5.238 3 8s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5zm3 7l-1 1-2-2-2 2-1-1 2-2.027L5 6l1-1 2 2 2-2 1 1-2 1.973L11 10z" fill="#E51400"/><path fill="#fff" d="M11 6l-1-1-2 2-2-2-1 1 2 1.973L5 10l1 1 2-2 2 2 1-1-2-2.027z"/></svg> | src/vs/editor/contrib/defineKeybinding/browser/status-error.svg | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00016871659317985177,
0.00016871659317985177,
0.00016871659317985177,
0.00016871659317985177,
0
] |
{
"id": 3,
"code_window": [
"\t\tThis event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).\n",
"\t\tA debug adapter is expected to send this event when it is ready to accept configuration requests.\n",
"\t\tThe sequence of events/requests is as follows:\n",
"\t\t- adapters sends InitializedEvent (at any time)\n",
"\t\t- frontend sends zero or more SetBreakpointsRequest\n",
"\t\t- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')\n",
"\t\t- frontend sends other configuration requests that are added in the future\n",
"\t\t- frontend sends one ConfigurationDoneRequest\n",
"\t*/\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t- frontend sends one SetFunctionBreakpointsRequest\n",
"\t\t- frontend sends a SetExceptionBreakpointsRequest if one or more exceptionBreakpointFilters have been defined (or if supportsConfigurationDoneRequest is not defined or false)\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 55
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import {DecorationSegment, ILineDecoration, LineDecorationsNormalizer} from 'vs/editor/common/viewLayout/viewLineParts';
suite('Editor ViewLayout - ViewLineParts', () => {
function newDecoration(startLineNumber:number, startColumn:number, endLineNumber:number, endColumn:number, inlineClassName:string): ILineDecoration {
return {
range: {
startLineNumber: startLineNumber,
startColumn: startColumn,
endLineNumber: endLineNumber,
endColumn: endColumn
},
options: {
inlineClassName: inlineClassName
}
};
}
test('Bug 9827:Overlapping inline decorations can cause wrong inline class to be applied', () => {
var result = LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 11, 'c1'),
newDecoration(1, 3, 1, 4, 'c2')
]);
assert.deepEqual(result, [
new DecorationSegment(0, 1, 'c1'),
new DecorationSegment(2, 2, 'c2 c1'),
new DecorationSegment(3, 9, 'c1'),
]);
});
test('issue #3462: no whitespace shown at the end of a decorated line', () => {
var result = LineDecorationsNormalizer.normalize(3, [
newDecoration(3, 15, 3, 21, 'trailing whitespace'),
newDecoration(3, 20, 3, 21, 'inline-folded'),
]);
assert.deepEqual(result, [
new DecorationSegment(14, 18, 'trailing whitespace'),
new DecorationSegment(19, 19, 'trailing whitespace inline-folded')
]);
});
test('ViewLineParts', () => {
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 2, 'c1'),
newDecoration(1, 3, 1, 4, 'c2')
]), [
new DecorationSegment(0, 0, 'c1'),
new DecorationSegment(2, 2, 'c2')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 3, 'c1'),
newDecoration(1, 3, 1, 4, 'c2')
]), [
new DecorationSegment(0, 1, 'c1'),
new DecorationSegment(2, 2, 'c2')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 4, 'c1'),
newDecoration(1, 3, 1, 4, 'c2')
]), [
new DecorationSegment(0, 1, 'c1'),
new DecorationSegment(2, 2, 'c1 c2')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 4, 'c1'),
newDecoration(1, 1, 1, 4, 'c1*'),
newDecoration(1, 3, 1, 4, 'c2')
]), [
new DecorationSegment(0, 1, 'c1 c1*'),
new DecorationSegment(2, 2, 'c1 c1* c2')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 4, 'c1'),
newDecoration(1, 1, 1, 4, 'c1*'),
newDecoration(1, 1, 1, 4, 'c1**'),
newDecoration(1, 3, 1, 4, 'c2')
]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 4, 'c1'),
newDecoration(1, 1, 1, 4, 'c1*'),
newDecoration(1, 1, 1, 4, 'c1**'),
newDecoration(1, 3, 1, 4, 'c2'),
newDecoration(1, 3, 1, 4, 'c2*')
]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*')
]);
assert.deepEqual(LineDecorationsNormalizer.normalize(1, [
newDecoration(1, 1, 1, 4, 'c1'),
newDecoration(1, 1, 1, 4, 'c1*'),
newDecoration(1, 1, 1, 4, 'c1**'),
newDecoration(1, 3, 1, 4, 'c2'),
newDecoration(1, 3, 1, 5, 'c2*')
]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'),
new DecorationSegment(3, 3, 'c2*')
]);
});
});
| src/vs/editor/test/common/viewLayout/viewLineParts.test.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017172702064272016,
0.0001700934226391837,
0.0001671395730227232,
0.00017027165449690074,
0.0000011921166560568963
] |
{
"id": 3,
"code_window": [
"\t\tThis event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).\n",
"\t\tA debug adapter is expected to send this event when it is ready to accept configuration requests.\n",
"\t\tThe sequence of events/requests is as follows:\n",
"\t\t- adapters sends InitializedEvent (at any time)\n",
"\t\t- frontend sends zero or more SetBreakpointsRequest\n",
"\t\t- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')\n",
"\t\t- frontend sends other configuration requests that are added in the future\n",
"\t\t- frontend sends one ConfigurationDoneRequest\n",
"\t*/\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t- frontend sends one SetFunctionBreakpointsRequest\n",
"\t\t- frontend sends a SetExceptionBreakpointsRequest if one or more exceptionBreakpointFilters have been defined (or if supportsConfigurationDoneRequest is not defined or false)\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 55
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as DomUtils from 'vs/base/browser/dom';
import {Gesture} from 'vs/base/browser/touch';
import {Disposable, IDisposable} from 'vs/base/common/lifecycle';
import {IScrollable} from 'vs/base/common/scrollable';
import {Emitter} from 'vs/base/common/event';
export class DomNodeScrollable extends Disposable implements IScrollable {
private _domNode: HTMLElement;
private _gestureHandler: Gesture;
private _onScroll = this._register(new Emitter<void>());
constructor(domNode: HTMLElement) {
super();
this._domNode = domNode;
this._gestureHandler = this._register(new Gesture(this._domNode));
this._register(DomUtils.addDisposableListener(this._domNode, 'scroll', (e) => this._onScroll.fire(void 0)));
}
public dispose() {
this._domNode = null;
super.dispose();
}
public getScrollHeight(): number {
return this._domNode.scrollHeight;
}
public getScrollWidth(): number {
return this._domNode.scrollWidth;
}
public getScrollLeft(): number {
return this._domNode.scrollLeft;
}
public setScrollLeft(scrollLeft: number): void {
this._domNode.scrollLeft = scrollLeft;
}
public getScrollTop(): number {
return this._domNode.scrollTop;
}
public setScrollTop(scrollTop: number): void {
this._domNode.scrollTop = scrollTop;
}
public addScrollListener(callback: () => void): IDisposable {
return this._onScroll.event(callback);
}
}
| src/vs/base/browser/ui/scrollbar/domNodeScrollable.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0001700119028100744,
0.00016792416863609105,
0.00016565751866437495,
0.00016759381105657667,
0.0000014849998706267797
] |
{
"id": 4,
"code_window": [
"\n",
"\t/** Event message for \"stopped\" event type.\n",
"\t\tThe event indicates that the execution of the debugee has stopped due to a break condition.\n",
"\t\tThis can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.\n",
"\t*/\n",
"\texport interface StoppedEvent extends Event {\n",
"\t\tbody: {\n",
"\t\t\t/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThis can be caused by a break point previously set, a stepping action has completed or by executing a debugger statement.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 64
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol
*/
declare module DebugProtocol {
/** Base class of requests, responses, and events. */
export interface ProtocolMessage {
/** Sequence number */
seq: number;
/** One of "request", "response", or "event" */
type: string;
}
/** Client-initiated request */
export interface Request extends ProtocolMessage {
/** The command to execute */
command: string;
/** Object containing arguments for the command */
arguments?: any;
}
/** Server-initiated event */
export interface Event extends ProtocolMessage {
/** Type of event */
event: string;
/** Event-specific information */
body?: any;
}
/** Server-initiated response to client request */
export interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request */
request_seq: number;
/** Outcome of the request */
success: boolean;
/** The command requested */
command: string;
/** Contains error message if success == false. */
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
//---- Events
/** Event message for "initialized" event type.
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
A debug adapter is expected to send this event when it is ready to accept configuration requests.
The sequence of events/requests is as follows:
- adapters sends InitializedEvent (at any time)
- frontend sends zero or more SetBreakpointsRequest
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
- frontend sends other configuration requests that are added in the future
- frontend sends one ConfigurationDoneRequest
*/
export interface InitializedEvent extends Event {
}
/** Event message for "stopped" event type.
The event indicates that the execution of the debugee has stopped due to a break condition.
This can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.
*/
export interface StoppedEvent extends Event {
body: {
/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */
reason: string;
/** The thread which was stopped. */
threadId?: number;
/** Additional information. E.g. if reason is 'exception', text contains the exception name. */
text?: string;
};
}
/** Event message for "exited" event type.
The event indicates that the debugee has exited.
*/
export interface ExitedEvent extends Event {
body: {
/** The exit code returned from the debuggee. */
exitCode: number;
};
}
/** Event message for "terminated" event types.
The event indicates that debugging of the debuggee has terminated.
*/
export interface TerminatedEvent extends Event {
body?: {
/** A debug adapter may set 'restart' to true to request that the front end restarts the session. */
restart?: boolean;
}
}
/** Event message for "thread" event type.
The event indicates that a thread has started or exited.
*/
export interface ThreadEvent extends Event {
body: {
/** The reason for the event (such as: 'started', 'exited'). */
reason: string;
/** The identifier of the thread. */
threadId: number;
};
}
/** Event message for "output" event type.
The event indicates that the target has produced output.
*/
export interface OutputEvent extends Event {
body: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category?: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
}
/** Event message for "breakpoint" event type.
The event indicates that some information about a breakpoint has changed.
*/
export interface BreakpointEvent extends Event {
body: {
/** The reason for the event (such as: 'changed', 'new'). */
reason: string;
/** The breakpoint. */
breakpoint: Breakpoint;
}
}
//---- Requests
/** On error that is whenever 'success' is false, the body can provide more details.
*/
export interface ErrorResponse extends Response {
body: {
/** An optional, structured error message. */
error?: Message
}
}
/** Initialize request; value of command field is "initialize".
*/
export interface InitializeRequest extends Request {
arguments: InitializeRequestArguments;
}
/** Arguments for "initialize" request. */
export interface InitializeRequestArguments {
/** The ID of the debugger adapter. Used to select or verify debugger adapter. */
adapterID: string;
/** If true all line numbers are 1-based (default). */
linesStartAt1?: boolean;
/** If true all column numbers are 1-based (default). */
columnsStartAt1?: boolean;
/** Determines in what format paths are specified. Possible values are 'path' or 'uri'. The default is 'path', which is the native format. */
pathFormat?: string;
}
/** Response to Initialize request. */
export interface InitializeResponse extends Response {
/** The capabilities of this debug adapter */
body?: Capabilites;
}
/** ConfigurationDone request; value of command field is "configurationDone".
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
*/
export interface ConfigurationDoneRequest extends Request {
arguments?: ConfigurationDoneArguments;
}
/** Arguments for "configurationDone" request. */
export interface ConfigurationDoneArguments {
/* The configurationDone request has no standardized attributes. */
}
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
export interface ConfigurationDoneResponse extends Response {
}
/** Launch request; value of command field is "launch".
*/
export interface LaunchRequest extends Request {
arguments: LaunchRequestArguments;
}
/** Arguments for "launch" request. */
export interface LaunchRequestArguments {
/* The launch request has no standardized attributes. */
}
/** Response to "launch" request. This is just an acknowledgement, so no body field is required. */
export interface LaunchResponse extends Response {
}
/** Attach request; value of command field is "attach".
*/
export interface AttachRequest extends Request {
arguments: AttachRequestArguments;
}
/** Arguments for "attach" request. */
export interface AttachRequestArguments {
/* The attach request has no standardized attributes. */
}
/** Response to "attach" request. This is just an acknowledgement, so no body field is required. */
export interface AttachResponse extends Response {
}
/** Disconnect request; value of command field is "disconnect".
*/
export interface DisconnectRequest extends Request {
arguments?: DisconnectArguments;
}
/** Arguments for "disconnect" request. */
export interface DisconnectArguments {
}
/** Response to "disconnect" request. This is just an acknowledgement, so no body field is required. */
export interface DisconnectResponse extends Response {
}
/** SetBreakpoints request; value of command field is "setBreakpoints".
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
To clear all breakpoint for a source, specify an empty array.
When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
*/
export interface SetBreakpointsRequest extends Request {
arguments: SetBreakpointsArguments;
}
/** Arguments for "setBreakpoints" request. */
export interface SetBreakpointsArguments {
/** The source location of the breakpoints; either source.path or source.reference must be specified. */
source: Source;
/** The code locations of the breakpoints. */
breakpoints?: SourceBreakpoint[];
/** Deprecated: The code locations of the breakpoints. */
lines?: number[];
}
/** Response to "setBreakpoints" request.
Returned is information about each breakpoint created by this request.
This includes the actual code location and whether the breakpoint could be verified.
*/
export interface SetBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */
breakpoints: Breakpoint[];
};
}
/** SetFunctionBreakpoints request; value of command field is "setFunctionBreakpoints".
Sets multiple function breakpoints and clears all previous function breakpoints.
To clear all function breakpoint, specify an empty array.
When a function breakpoint is hit, a StoppedEvent (event type 'function breakpoint') is generated.
*/
export interface SetFunctionBreakpointsRequest extends Request {
arguments: SetFunctionBreakpointsArguments;
}
/** Arguments for "setFunctionBreakpoints" request. */
export interface SetFunctionBreakpointsArguments {
/** The function names of the breakpoints. */
breakpoints: FunctionBreakpoint[];
}
/** Response to "setFunctionBreakpoints" request.
Returned is information about each breakpoint created by this request.
*/
export interface SetFunctionBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
breakpoints: Breakpoint[];
};
}
/** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
*/
export interface SetExceptionBreakpointsRequest extends Request {
arguments: SetExceptionBreakpointsArguments;
}
/** Arguments for "setExceptionBreakpoints" request. */
export interface SetExceptionBreakpointsArguments {
/** Names of enabled exception breakpoints. */
filters: string[];
}
/** Response to "setExceptionBreakpoints" request. This is just an acknowledgement, so no body field is required. */
export interface SetExceptionBreakpointsResponse extends Response {
}
/** Continue request; value of command field is "continue".
The request starts the debuggee to run again.
*/
export interface ContinueRequest extends Request {
arguments: ContinueArguments;
}
/** Arguments for "continue" request. */
export interface ContinueArguments {
/** continue execution for this thread. */
threadId: number;
}
/** Response to "continue" request. This is just an acknowledgement, so no body field is required. */
export interface ContinueResponse extends Response {
}
/** Next request; value of command field is "next".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface NextRequest extends Request {
arguments: NextArguments;
}
/** Arguments for "next" request. */
export interface NextArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "next" request. This is just an acknowledgement, so no body field is required. */
export interface NextResponse extends Response {
}
/** StepIn request; value of command field is "stepIn".
The request starts the debuggee to run again for one step.
The debug adapter will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepInRequest extends Request {
arguments: StepInArguments;
}
/** Arguments for "stepIn" request. */
export interface StepInArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepIn" request. This is just an acknowledgement, so no body field is required. */
export interface StepInResponse extends Response {
}
/** StepOutIn request; value of command field is "stepOut".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepOutRequest extends Request {
arguments: StepOutArguments;
}
/** Arguments for "stepOut" request. */
export interface StepOutArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepOut" request. This is just an acknowledgement, so no body field is required. */
export interface StepOutResponse extends Response {
}
/** Pause request; value of command field is "pause".
The request suspenses the debuggee.
penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command.
*/
export interface PauseRequest extends Request {
arguments: PauseArguments;
}
/** Arguments for "pause" request. */
export interface PauseArguments {
/** Pause execution for this thread. */
threadId: number;
}
/** Response to "pause" request. This is just an acknowledgement, so no body field is required. */
export interface PauseResponse extends Response {
}
/** StackTrace request; value of command field is "stackTrace".
The request returns a stacktrace from the current execution state.
*/
export interface StackTraceRequest extends Request {
arguments: StackTraceArguments;
}
/** Arguments for "stackTrace" request. */
export interface StackTraceArguments {
/** Retrieve the stacktrace for this thread. */
threadId: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
}
/** Response to "stackTrace" request. */
export interface StackTraceResponse extends Response {
body: {
/** The frames of the stackframe. If the array has length zero, there are no stackframes available.
This means that there is no location information available. */
stackFrames: StackFrame[];
};
}
/** Scopes request; value of command field is "scopes".
The request returns the variable scopes for a given stackframe ID.
*/
export interface ScopesRequest extends Request {
arguments: ScopesArguments;
}
/** Arguments for "scopes" request. */
export interface ScopesArguments {
/** Retrieve the scopes for this stackframe. */
frameId: number;
}
/** Response to "scopes" request. */
export interface ScopesResponse extends Response {
body: {
/** The scopes of the stackframe. If the array has length zero, there are no scopes available. */
scopes: Scope[];
};
}
/** Variables request; value of command field is "variables".
Retrieves all children for the given variable reference.
*/
export interface VariablesRequest extends Request {
arguments: VariablesArguments;
}
/** Arguments for "variables" request. */
export interface VariablesArguments {
/** The Variable reference. */
variablesReference: number;
}
/** Response to "variables" request. */
export interface VariablesResponse extends Response {
body: {
/** All children for the given variable reference */
variables: Variable[];
};
}
/** Source request; value of command field is "source".
The request retrieves the source code for a given source reference.
*/
export interface SourceRequest extends Request {
arguments: SourceArguments;
}
/** Arguments for "source" request. */
export interface SourceArguments {
/** The reference to the source. This is the value received in Source.reference. */
sourceReference: number;
}
/** Response to "source" request. */
export interface SourceResponse extends Response {
body: {
/** Content of the source reference */
content: string;
};
}
/** Thread request; value of command field is "threads".
The request retrieves a list of all threads.
*/
export interface ThreadsRequest extends Request {
}
/** Response to "threads" request. */
export interface ThreadsResponse extends Response {
body: {
/** All threads. */
threads: Thread[];
};
}
/** Evaluate request; value of command field is "evaluate".
Evaluates the given expression in the context of the top most stack frame.
The expression has access to any variables and arguments that are in scope.
*/
export interface EvaluateRequest extends Request {
arguments: EvaluateArguments;
}
/** Arguments for "evaluate" request. */
export interface EvaluateArguments {
/** The expression to evaluate. */
expression: string;
/** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
}
/** Response to "evaluate" request. */
export interface EvaluateResponse extends Response {
body: {
/** The result of the evaluate. */
result: string;
/** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest */
variablesReference: number;
};
}
//---- Types
/** Information about the capabilities of a debug adapter. */
export interface Capabilites {
/** The debug adapter supports the configurationDoneRequest. */
supportsConfigurationDoneRequest?: boolean;
/** The debug adapter supports functionBreakpoints. */
supportsFunctionBreakpoints?: boolean;
/** The debug adapter supports conditionalBreakpoints. */
supportsConditionalBreakpoints?: boolean;
/** The debug adapter supports a (side effect free) evaluate request for data hovers. */
supportsEvaluateForHovers?: boolean;
/** Available filters for the setExceptionBreakpoints request. */
exceptionBreakpointFilters?: [
{
filter: string,
label: string
}
]
}
/** A structured message object. Used to return errors from requests. */
export interface Message {
/** Unique identifier for the message. */
id: number;
/** A format string for the message. Embedded variables have the form '{name}'.
If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. */
format: string;
/** An object used as a dictionary for looking up the variables in the format string. */
variables?: { [key: string]: string };
/** if true send to telemetry */
sendTelemetry?: boolean;
/** if true show user */
showUser?: boolean;
}
/** A Thread */
export interface Thread {
/** Unique identifier for the thread. */
id: number;
/** A name of the thread. */
name: string;
}
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
/** The long (absolute) path of the source. It is not guaranteed that the source exists at this location. */
path?: string;
/** If sourceReference > 0 the contents of the source can be retrieved through the SourceRequest. A sourceReference is only valid for a session, so it must not be used to persist a source. */
sourceReference?: number;
/** The (optional) origin of this source: possible values "internal module", "inlined content from source map", etc. */
origin?: string;
/** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */
adapterData?: any;
}
/** A Stackframe contains the source location. */
export interface StackFrame {
/** An identifier for the stack frame. This id can be used to retrieve the scopes of the frame with the 'scopesRequest'. */
id: number;
/** The name of the stack frame, typically a method name */
name: string;
/** The optional source of the frame. */
source?: Source;
/** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */
line: number;
/** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */
column: number;
}
/** A Scope is a named container for variables. */
export interface Scope {
/** name of the scope (as such 'Arguments', 'Locals') */
name: string;
/** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */
variablesReference: number;
/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
/** A Variable is a name/value pair.
If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest.
*/
export interface Variable {
/** The variable's name */
name: string;
/** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
value: string;
/** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
variablesReference: number;
}
/** Properties of a breakpoint passed to the setBreakpoints request.
*/
export interface SourceBreakpoint {
/** The source line of the breakpoint. */
line: number;
/** An optional source column of the breakpoint. */
column?: number;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Properties of a breakpoint passed to the setFunctionBreakpoints request.
*/
export interface FunctionBreakpoint {
/** The name of the function. */
name: string;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.
*/
export interface Breakpoint {
/** An optional unique identifier for the breakpoint. */
id?: number;
/** If true breakpoint could be set (but not necessarily at the desired location). */
verified: boolean;
/** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */
message?: string;
/** The source where the breakpoint is located. */
source?: Source;
/** The actual line of the breakpoint. */
line?: number;
/** The actual column of the breakpoint. */
column?: number;
}
}
| src/vs/workbench/parts/debug/common/debugProtocol.d.ts | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.9988676309585571,
0.12986813485622406,
0.00016402913024649024,
0.00018848833860829473,
0.3338446319103241
] |
{
"id": 4,
"code_window": [
"\n",
"\t/** Event message for \"stopped\" event type.\n",
"\t\tThe event indicates that the execution of the debugee has stopped due to a break condition.\n",
"\t\tThis can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.\n",
"\t*/\n",
"\texport interface StoppedEvent extends Event {\n",
"\t\tbody: {\n",
"\t\t\t/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThis can be caused by a break point previously set, a stepping action has completed or by executing a debugger statement.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 64
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands';
import Severity from 'vs/base/common/severity';
import {isFalsyOrEmpty} from 'vs/base/common/arrays';
import {IDisposable} from 'vs/base/common/lifecycle';
import * as modes from 'vs/editor/common/modes';
import * as types from './extHostTypes';
import {Position as EditorPosition} from 'vs/platform/editor/common/editor';
import {IPosition, ISelection, IRange, IRangeWithMessage, ISingleEditOperation} from 'vs/editor/common/editorCommon';
import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import {ITypeBearing} from 'vs/workbench/parts/search/common/search';
import * as vscode from 'vscode';
export interface PositionLike {
line: number;
character: number;
}
export interface RangeLike {
start: PositionLike;
end: PositionLike;
}
export interface SelectionLike extends RangeLike {
anchor: PositionLike;
active: PositionLike;
}
export function toSelection(selection: ISelection): types.Selection {
let {selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn} = selection;
let start = new types.Position(selectionStartLineNumber - 1, selectionStartColumn - 1);
let end = new types.Position(positionLineNumber - 1, positionColumn - 1);
return new types.Selection(start, end);
}
export function fromSelection(selection: SelectionLike): ISelection {
let {anchor, active} = selection;
return {
selectionStartLineNumber: anchor.line + 1,
selectionStartColumn: anchor.character + 1,
positionLineNumber: active.line + 1,
positionColumn: active.character + 1
};
}
export function fromRange(range: RangeLike): IRange {
let {start, end} = range;
return {
startLineNumber: start.line + 1,
startColumn: start.character + 1,
endLineNumber: end.line + 1,
endColumn: end.character + 1
};
}
export function toRange(range: IRange): types.Range {
let {startLineNumber, startColumn, endLineNumber, endColumn} = range;
return new types.Range(startLineNumber - 1, startColumn - 1, endLineNumber - 1, endColumn - 1);
}
export function toPosition(position: IPosition): types.Position {
return new types.Position(position.lineNumber - 1, position.column - 1);
}
export function fromPosition(position: types.Position):IPosition {
return { lineNumber: position.line + 1, column: position.character + 1};
}
export function fromDiagnosticSeverity(value: number): Severity {
switch (value) {
case types.DiagnosticSeverity.Error:
return Severity.Error;
case types.DiagnosticSeverity.Warning:
return Severity.Warning;
case types.DiagnosticSeverity.Information:
return Severity.Info;
case types.DiagnosticSeverity.Hint:
return Severity.Ignore;
}
return Severity.Error;
}
export function toDiagnosticSeverty(value: Severity): types.DiagnosticSeverity {
switch (value) {
case Severity.Info:
return types.DiagnosticSeverity.Information;
case Severity.Warning:
return types.DiagnosticSeverity.Warning;
case Severity.Error:
return types.DiagnosticSeverity.Error;
case Severity.Ignore:
return types.DiagnosticSeverity.Hint;
}
return types.DiagnosticSeverity.Error;
}
export function fromViewColumn(column?: vscode.ViewColumn): EditorPosition {
let editorColumn = EditorPosition.LEFT;
if (typeof column !== 'number') {
// stick with LEFT
} else if (column === <number>types.ViewColumn.Two) {
editorColumn = EditorPosition.CENTER;
} else if (column === <number>types.ViewColumn.Three) {
editorColumn = EditorPosition.RIGHT;
}
return editorColumn;
}
export function toViewColumn(position?: EditorPosition): vscode.ViewColumn {
if (typeof position !== 'number') {
return;
}
if (position === EditorPosition.LEFT) {
return <number> types.ViewColumn.One;
} else if (position === EditorPosition.CENTER) {
return <number> types.ViewColumn.Two;
} else if (position === EditorPosition.RIGHT) {
return <number> types.ViewColumn.Three;
}
}
export function fromFormattedString(value: vscode.MarkedString): IHTMLContentElement {
if (typeof value === 'string') {
return { markdown: value };
} else if (typeof value === 'object') {
return { code: value };
}
}
export function toFormattedString(value: IHTMLContentElement): vscode.MarkedString {
if (typeof value.code === 'string') {
return value.code;
}
let {markdown, text} = value;
return markdown || text || '<???>';
}
function isMarkedStringArr(something: vscode.MarkedString | vscode.MarkedString[]): something is vscode.MarkedString[] {
return Array.isArray(something);
}
function fromMarkedStringOrMarkedStringArr(something: vscode.MarkedString | vscode.MarkedString[]): IHTMLContentElement[] {
if (isMarkedStringArr(something)) {
return something.map(msg => fromFormattedString(msg));
} else if (something) {
return [fromFormattedString(something)];
} else {
return [];
}
}
function isRangeWithMessage(something: any): something is vscode.DecorationOptions {
return (typeof something.range !== 'undefined');
}
function isRangeWithMessageArr(something: vscode.Range[]|vscode.DecorationOptions[]): something is vscode.DecorationOptions[] {
if (something.length === 0) {
return true;
}
return isRangeWithMessage(something[0]) ? true : false;
}
export function fromRangeOrRangeWithMessage(ranges:vscode.Range[]|vscode.DecorationOptions[]): IRangeWithMessage[] {
if (isRangeWithMessageArr(ranges)) {
return ranges.map((r): IRangeWithMessage => {
return {
range: fromRange(r.range),
hoverMessage: fromMarkedStringOrMarkedStringArr(r.hoverMessage)
};
});
} else {
return ranges.map((r): IRangeWithMessage => {
return {
range: fromRange(r)
};
});
}
}
export const TextEdit = {
from(edit: vscode.TextEdit): ISingleEditOperation{
return <ISingleEditOperation>{
text: edit.newText,
range: fromRange(edit.range)
};
},
to(edit: ISingleEditOperation): vscode.TextEdit {
return new types.TextEdit(toRange(edit.range), edit.text);
}
};
export namespace SymbolKind {
export function from(kind: number | types.SymbolKind): string {
switch (kind) {
case types.SymbolKind.Method:
return 'method';
case types.SymbolKind.Function:
return 'function';
case types.SymbolKind.Constructor:
return 'constructor';
case types.SymbolKind.Variable:
return 'variable';
case types.SymbolKind.Class:
return 'class';
case types.SymbolKind.Interface:
return 'interface';
case types.SymbolKind.Namespace:
return 'namespace';
case types.SymbolKind.Package:
return 'package';
case types.SymbolKind.Module:
return 'module';
case types.SymbolKind.Property:
return 'property';
case types.SymbolKind.Enum:
return 'enum';
case types.SymbolKind.String:
return 'string';
case types.SymbolKind.File:
return 'file';
case types.SymbolKind.Array:
return 'array';
case types.SymbolKind.Number:
return 'number';
case types.SymbolKind.Boolean:
return 'boolean';
case types.SymbolKind.Object:
return 'object';
case types.SymbolKind.Key:
return 'key';
case types.SymbolKind.Null:
return 'null';
}
return 'property';
}
export function to(type: string): types.SymbolKind {
switch (type) {
case 'method':
return types.SymbolKind.Method;
case 'function':
return types.SymbolKind.Function;
case 'constructor':
return types.SymbolKind.Constructor;
case 'variable':
return types.SymbolKind.Variable;
case 'class':
return types.SymbolKind.Class;
case 'interface':
return types.SymbolKind.Interface;
case 'namespace':
return types.SymbolKind.Namespace;
case 'package':
return types.SymbolKind.Package;
case 'module':
return types.SymbolKind.Module;
case 'property':
return types.SymbolKind.Property;
case 'enum':
return types.SymbolKind.Enum;
case 'string':
return types.SymbolKind.String;
case 'file':
return types.SymbolKind.File;
case 'array':
return types.SymbolKind.Array;
case 'number':
return types.SymbolKind.Number;
case 'boolean':
return types.SymbolKind.Boolean;
case 'object':
return types.SymbolKind.Object;
case 'key':
return types.SymbolKind.Key;
case 'null':
return types.SymbolKind.Null;
}
return types.SymbolKind.Property;
}
}
export namespace SymbolInformation {
export function fromOutlineEntry(entry: modes.IOutlineEntry): types.SymbolInformation {
return new types.SymbolInformation(entry.label,
SymbolKind.to(entry.type),
toRange(entry.range),
undefined,
entry.containerLabel);
}
export function toOutlineEntry(symbol: vscode.SymbolInformation): modes.IOutlineEntry {
return <modes.IOutlineEntry>{
type: SymbolKind.from(symbol.kind),
range: fromRange(symbol.location.range),
containerLabel: symbol.containerName,
label: symbol.name,
icon: undefined,
};
}
}
export function fromSymbolInformation(info: vscode.SymbolInformation): ITypeBearing {
return <ITypeBearing>{
name: info.name,
type: types.SymbolKind[info.kind || types.SymbolKind.Property].toLowerCase(),
range: fromRange(info.location.range),
resourceUri: info.location.uri,
containerName: info.containerName,
parameters: '',
};
}
export function toSymbolInformation(bearing: ITypeBearing): types.SymbolInformation {
return new types.SymbolInformation(bearing.name,
types.SymbolKind[bearing.type.charAt(0).toUpperCase() + bearing.type.substr(1)],
toRange(bearing.range),
bearing.resourceUri,
bearing.containerName);
}
export const location = {
from(value: types.Location): modes.IReference {
return {
range: fromRange(value.range),
resource: value.uri
};
},
to(value: modes.IReference): types.Location {
return new types.Location(value.resource, toRange(value.range));
}
};
export function fromHover(hover: vscode.Hover): modes.IComputeExtraInfoResult {
return <modes.IComputeExtraInfoResult>{
range: fromRange(hover.range),
htmlContent: hover.contents.map(fromFormattedString)
};
}
export function toHover(info: modes.IComputeExtraInfoResult): types.Hover {
return new types.Hover(info.htmlContent.map(toFormattedString), toRange(info.range));
}
export function toDocumentHighlight(occurrence: modes.IOccurence): types.DocumentHighlight {
return new types.DocumentHighlight(toRange(occurrence.range),
types.DocumentHighlightKind[occurrence.kind.charAt(0).toUpperCase() + occurrence.kind.substr(1)]);
}
export const Suggest = {
from(item: vscode.CompletionItem): modes.ISuggestion {
const suggestion: modes.ISuggestion = {
label: item.label,
codeSnippet: item.insertText || item.label,
type: types.CompletionItemKind[item.kind || types.CompletionItemKind.Text].toString().toLowerCase(),
typeLabel: item.detail,
documentationLabel: item.documentation,
sortText: item.sortText,
filterText: item.filterText
};
return suggestion;
},
to(container: modes.ISuggestResult, position: types.Position, suggestion: modes.ISuggestion): types.CompletionItem {
const result = new types.CompletionItem(suggestion.label);
result.insertText = suggestion.codeSnippet;
result.kind = types.CompletionItemKind[suggestion.type.charAt(0).toUpperCase() + suggestion.type.substr(1)];
result.detail = suggestion.typeLabel;
result.documentation = suggestion.documentationLabel;
result.sortText = suggestion.sortText;
result.filterText = suggestion.filterText;
let overwriteBefore = (typeof suggestion.overwriteBefore === 'number') ? suggestion.overwriteBefore : container.currentWord.length;
let startPosition = new types.Position(position.line, Math.max(0, position.character - overwriteBefore));
let endPosition = position;
if (typeof suggestion.overwriteAfter === 'number') {
endPosition = new types.Position(position.line, position.character + suggestion.overwriteAfter);
}
result.textEdit = types.TextEdit.replace(new types.Range(startPosition, endPosition), suggestion.codeSnippet);
return result;
}
};
export namespace SignatureHelp {
export function from(signatureHelp: types.SignatureHelp): modes.IParameterHints {
let result: modes.IParameterHints = {
currentSignature: signatureHelp.activeSignature,
currentParameter: signatureHelp.activeParameter,
signatures: []
};
for (let signature of signatureHelp.signatures) {
let signatureItem: modes.ISignature = {
label: signature.label,
documentation: signature.documentation,
parameters: []
};
let idx = 0;
for (let parameter of signature.parameters) {
let parameterItem: modes.IParameter = {
label: parameter.label,
documentation: parameter.documentation,
};
signatureItem.parameters.push(parameterItem);
idx = signature.label.indexOf(parameter.label, idx);
if (idx >= 0) {
parameterItem.signatureLabelOffset = idx;
idx += parameter.label.length;
parameterItem.signatureLabelEnd = idx;
} else {
parameterItem.signatureLabelOffset = 0;
parameterItem.signatureLabelEnd = 0;
}
}
result.signatures.push(signatureItem);
}
return result;
}
export function to(hints: modes.IParameterHints): types.SignatureHelp {
const result = new types.SignatureHelp();
result.activeSignature = hints.currentSignature;
result.activeParameter = hints.currentParameter;
for (let signature of hints.signatures) {
const signatureItem = new types.SignatureInformation(signature.label, signature.documentation);
result.signatures.push(signatureItem);
for (let parameter of signature.parameters) {
const parameterItem = new types.ParameterInformation(parameter.label, parameter.documentation);
signatureItem.parameters.push(parameterItem);
}
}
return result;
}
}
export namespace Command {
const _cache: { [id: string]: vscode.Command } = Object.create(null);
let _idPool = 1;
export function from(command: vscode.Command, context: { commands: ExtHostCommands; disposables: IDisposable[]; }): modes.ICommand {
if (!command) {
return;
}
const result = <modes.ICommand>{
id: command.command,
title: command.title
};
if (!isFalsyOrEmpty(command.arguments)) {
// keep command around
const id = `${command.command}-no-args-wrapper-${_idPool++}`;
result.id = id;
_cache[id] = command;
const disposable1 = context.commands.registerCommand(id, () => context.commands.executeCommand(command.command, ..._cache[id].arguments));
const disposable2 = { dispose() { delete _cache[id]; } };
context.disposables.push(disposable1, disposable2);
}
return result;
}
export function to(command: modes.ICommand): vscode.Command {
let result = _cache[command.id];
if (!result) {
result = {
command: command.id,
title: command.title
};
}
return result;
}
}
| src/vs/workbench/api/node/extHostTypeConverters.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017659386503510177,
0.00017129398474935442,
0.00016417026927229017,
0.00017178778944071382,
0.0000029443199309753254
] |
{
"id": 4,
"code_window": [
"\n",
"\t/** Event message for \"stopped\" event type.\n",
"\t\tThe event indicates that the execution of the debugee has stopped due to a break condition.\n",
"\t\tThis can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.\n",
"\t*/\n",
"\texport interface StoppedEvent extends Event {\n",
"\t\tbody: {\n",
"\t\t\t/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThis can be caused by a break point previously set, a stepping action has completed or by executing a debugger statement.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 64
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {ILanguage} from './types';
export var language = <ILanguage> {
displayName: 'Jade',
name: 'jade',
defaultToken: '',
ignoreCase: true,
lineComment: '//',
brackets: [
{ token:'delimiter.curly', open: '{', close: '}' },
{ token:'delimiter.array', open: '[', close: ']' },
{ token:'delimiter.parenthesis', open: '(', close: ')' }
],
keywords: [ 'append', 'block', 'case', 'default', 'doctype', 'each', 'else', 'extends',
'for', 'if', 'in', 'include', 'mixin', 'typeof', 'unless', 'var', 'when'],
tags: [
'a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio',
'b', 'base', 'basefont', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button',
'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command',
'datalist', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt',
'em', 'embed',
'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html',
'i', 'iframe', 'img', 'input', 'ins',
'keygen', 'kbd',
'label', 'li', 'link',
'map', 'mark', 'menu', 'meta', 'meter',
'nav', 'noframes', 'noscript',
'object', 'ol', 'optgroup', 'option', 'output',
'p', 'param', 'pre', 'progress',
'q',
'rp', 'rt', 'ruby',
's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup',
'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'tracks', 'tt',
'u', 'ul',
'video',
'wbr'
],
// we include these common regular expressions
symbols: /[\+\-\*\%\&\|\!\=\/\.\,\:]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
tokenizer: {
root: [
// Tag or a keyword at start
[/^(\s*)([a-zA-Z_-][\w-]*)/,
{ cases: {
'$2@tags': { cases: { '@eos': ['', 'tag'], '@default': ['', { token: 'tag', next: '@tag.$1' }, ] } },
'$2@keywords': [ '', { token: 'keyword.$2'}, ],
'@default': [ '', '', ]}}
],
// id
[/^(\s*)(#[a-zA-Z_-][\w-]*)/, { cases: { '@eos': ['', 'tag.id'], '@default': ['', { token: 'tag.id', next: '@tag.$1' }] }}],
// class
[/^(\s*)(\.[a-zA-Z_-][\w-]*)/, { cases: { '@eos': ['', 'tag.class'], '@default': ['', { token: 'tag.class', next: '@tag.$1' }] } }],
// plain text with pipe
[/^(\s*)(\|.*)$/, '' ],
{ include: '@whitespace' },
// keywords
[/[a-zA-Z_$][\w$]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': '' } }],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, 'delimiter'],
// numbers
[/\d+\.\d+([eE][\-+]?\d+)?/, 'number.float'],
[/\d+/, 'number'],
// strings:
[/"/, 'string', '@string."' ],
[/'/, 'string', '@string.\''],
],
tag: [
[/(\.)(\s*$)/, [ {token: 'delimiter', next:'@blockText.$S2.'}, '']],
[/\s+/, { token: '', next: '@simpleText' }],
// id
[/#[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.id', next: '@pop' }, '@default': 'tag.id' } }],
// class
[/\.[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.class', next: '@pop' }, '@default': 'tag.class' } }],
// attributes
[/\(/, { token: 'delimiter.parenthesis', bracket: '@open', next: '@attributeList' }],
],
simpleText: [
[/[^#]+$/, {token: '', next: '@popall'}],
[/[^#]+/, {token: ''}],
// interpolation
[/(#{)([^}]*)(})/, { cases: {
'@eos': ['interpolation.delimiter', 'interpolation', { token: 'interpolation.delimiter', next: '@popall' }],
'@default': ['interpolation.delimiter', 'interpolation', 'interpolation.delimiter'] }}],
[/#$/, { token: '', next: '@popall' }],
[/#/, '']
],
attributeList: [
[/\s+/, '' ],
[/(\w+)(\s*=\s*)("|')/, ['attribute.name', 'delimiter', { token: 'attribute.value', next:'@value.$3'}]],
[/\w+/, 'attribute.name'],
[/,/, { cases: { '@eos': { token: 'attribute.delimiter', next: '@popall' }, '@default': 'attribute.delimiter' } }],
[/\)$/, { token: 'delimiter.parenthesis', bracket: '@close', next: '@popall' }],
[/\)/, { token: 'delimiter.parenthesis', bracket: '@close', next: '@pop' }],
],
whitespace: [
[/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' } ],
[/[ \t\r\n]+/, ''],
[/<!--/, { token: 'comment', bracket: '@open', next: '@comment' }],
],
blockText: [
[/^\s+.*$/, { cases: { '($S2\\s+.*$)': { token: '$S3' }, '@default': { token: '@rematch', next: '@popall' } } }],
[/./, { token: '@rematch', next: '@popall' }]
],
comment: [
[/[^<\-]+/, 'comment.content' ],
[/-->/, { token: 'comment', bracket: '@close', next: '@pop' } ],
[/<!--/, 'comment.content.invalid'],
[/[<\-]/, 'comment.content' ]
],
string: [
[/[^\\"'#]+/, { cases: { '@eos': { token: 'string', next: '@popall' }, '@default': 'string' } }],
[/@escapes/, { cases: { '@eos': { token: 'string.escape', next: '@popall' }, '@default': 'string.escape' }}],
[/\\./, { cases: { '@eos': { token: 'string.escape.invalid', next: '@popall' }, '@default': 'string.escape.invalid' }}],
// interpolation
[/(#{)([^}]*)(})/, ['interpolation.delimiter', 'interpolation', 'interpolation.delimiter']],
[/#/, 'string'],
[/["']/, { cases: { '$#==$S2': { token: 'string', next: '@pop' }, '@default': { token: 'string' } } }],
],
// Almost identical to above, except for escapes and the output token
value: [
[/[^\\"']+/, { cases: { '@eos': { token: 'attribute.value', next: '@popall' }, '@default': 'attribute.value' }}],
[/\\./, { cases: { '@eos': { token: 'attribute.value', next: '@popall' }, '@default': 'attribute.value' }}],
[/["']/, { cases: { '$#==$S2': { token: 'attribute.value', next: '@pop' }, '@default': { token: 'attribute.value' } } }],
],
},
}; | src/vs/editor/standalone-languages/jade.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017610422219149768,
0.00017252849647775292,
0.00016877084271982312,
0.0001723024033708498,
0.0000020763138763868483
] |
{
"id": 4,
"code_window": [
"\n",
"\t/** Event message for \"stopped\" event type.\n",
"\t\tThe event indicates that the execution of the debugee has stopped due to a break condition.\n",
"\t\tThis can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.\n",
"\t*/\n",
"\texport interface StoppedEvent extends Event {\n",
"\t\tbody: {\n",
"\t\t\t/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThis can be caused by a break point previously set, a stepping action has completed or by executing a debugger statement.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 64
} | // ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "Colorsublime-Themes",
"version": "0.1.0",
"repositoryURL": "https://github.com/Colorsublime/Colorsublime-Themes",
"description": "The themes in this folders are copied from colorsublime.com. <<<TODO check the licenses, we can easily drop the themes>>>"
}]
| extensions/theme-abyss/OSSREADME.json | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017579016275703907,
0.00017579016275703907,
0.00017579016275703907,
0.00017579016275703907,
0
] |
{
"id": 5,
"code_window": [
"\t\tlines?: number[];\n",
"\t}\n",
"\t/** Response to \"setBreakpoints\" request.\n",
"\t\tReturned is information about each breakpoint created by this request.\n",
"\t\tThis includes the actual code location and whether the breakpoint could be verified.\n",
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThe breakpoints returned are in the same order as the elements of the 'breakpoints'\n",
"\t\t(or the deprecated 'lines') in the SetBreakpointsArguments.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"edit_start_line_idx": 240
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol
*/
declare module DebugProtocol {
/** Base class of requests, responses, and events. */
export interface ProtocolMessage {
/** Sequence number */
seq: number;
/** One of "request", "response", or "event" */
type: string;
}
/** Client-initiated request */
export interface Request extends ProtocolMessage {
/** The command to execute */
command: string;
/** Object containing arguments for the command */
arguments?: any;
}
/** Server-initiated event */
export interface Event extends ProtocolMessage {
/** Type of event */
event: string;
/** Event-specific information */
body?: any;
}
/** Server-initiated response to client request */
export interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request */
request_seq: number;
/** Outcome of the request */
success: boolean;
/** The command requested */
command: string;
/** Contains error message if success == false. */
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
//---- Events
/** Event message for "initialized" event type.
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
A debug adapter is expected to send this event when it is ready to accept configuration requests.
The sequence of events/requests is as follows:
- adapters sends InitializedEvent (at any time)
- frontend sends zero or more SetBreakpointsRequest
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
- frontend sends other configuration requests that are added in the future
- frontend sends one ConfigurationDoneRequest
*/
export interface InitializedEvent extends Event {
}
/** Event message for "stopped" event type.
The event indicates that the execution of the debugee has stopped due to a break condition.
This can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.
*/
export interface StoppedEvent extends Event {
body: {
/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */
reason: string;
/** The thread which was stopped. */
threadId?: number;
/** Additional information. E.g. if reason is 'exception', text contains the exception name. */
text?: string;
};
}
/** Event message for "exited" event type.
The event indicates that the debugee has exited.
*/
export interface ExitedEvent extends Event {
body: {
/** The exit code returned from the debuggee. */
exitCode: number;
};
}
/** Event message for "terminated" event types.
The event indicates that debugging of the debuggee has terminated.
*/
export interface TerminatedEvent extends Event {
body?: {
/** A debug adapter may set 'restart' to true to request that the front end restarts the session. */
restart?: boolean;
}
}
/** Event message for "thread" event type.
The event indicates that a thread has started or exited.
*/
export interface ThreadEvent extends Event {
body: {
/** The reason for the event (such as: 'started', 'exited'). */
reason: string;
/** The identifier of the thread. */
threadId: number;
};
}
/** Event message for "output" event type.
The event indicates that the target has produced output.
*/
export interface OutputEvent extends Event {
body: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category?: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
}
/** Event message for "breakpoint" event type.
The event indicates that some information about a breakpoint has changed.
*/
export interface BreakpointEvent extends Event {
body: {
/** The reason for the event (such as: 'changed', 'new'). */
reason: string;
/** The breakpoint. */
breakpoint: Breakpoint;
}
}
//---- Requests
/** On error that is whenever 'success' is false, the body can provide more details.
*/
export interface ErrorResponse extends Response {
body: {
/** An optional, structured error message. */
error?: Message
}
}
/** Initialize request; value of command field is "initialize".
*/
export interface InitializeRequest extends Request {
arguments: InitializeRequestArguments;
}
/** Arguments for "initialize" request. */
export interface InitializeRequestArguments {
/** The ID of the debugger adapter. Used to select or verify debugger adapter. */
adapterID: string;
/** If true all line numbers are 1-based (default). */
linesStartAt1?: boolean;
/** If true all column numbers are 1-based (default). */
columnsStartAt1?: boolean;
/** Determines in what format paths are specified. Possible values are 'path' or 'uri'. The default is 'path', which is the native format. */
pathFormat?: string;
}
/** Response to Initialize request. */
export interface InitializeResponse extends Response {
/** The capabilities of this debug adapter */
body?: Capabilites;
}
/** ConfigurationDone request; value of command field is "configurationDone".
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
*/
export interface ConfigurationDoneRequest extends Request {
arguments?: ConfigurationDoneArguments;
}
/** Arguments for "configurationDone" request. */
export interface ConfigurationDoneArguments {
/* The configurationDone request has no standardized attributes. */
}
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
export interface ConfigurationDoneResponse extends Response {
}
/** Launch request; value of command field is "launch".
*/
export interface LaunchRequest extends Request {
arguments: LaunchRequestArguments;
}
/** Arguments for "launch" request. */
export interface LaunchRequestArguments {
/* The launch request has no standardized attributes. */
}
/** Response to "launch" request. This is just an acknowledgement, so no body field is required. */
export interface LaunchResponse extends Response {
}
/** Attach request; value of command field is "attach".
*/
export interface AttachRequest extends Request {
arguments: AttachRequestArguments;
}
/** Arguments for "attach" request. */
export interface AttachRequestArguments {
/* The attach request has no standardized attributes. */
}
/** Response to "attach" request. This is just an acknowledgement, so no body field is required. */
export interface AttachResponse extends Response {
}
/** Disconnect request; value of command field is "disconnect".
*/
export interface DisconnectRequest extends Request {
arguments?: DisconnectArguments;
}
/** Arguments for "disconnect" request. */
export interface DisconnectArguments {
}
/** Response to "disconnect" request. This is just an acknowledgement, so no body field is required. */
export interface DisconnectResponse extends Response {
}
/** SetBreakpoints request; value of command field is "setBreakpoints".
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
To clear all breakpoint for a source, specify an empty array.
When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
*/
export interface SetBreakpointsRequest extends Request {
arguments: SetBreakpointsArguments;
}
/** Arguments for "setBreakpoints" request. */
export interface SetBreakpointsArguments {
/** The source location of the breakpoints; either source.path or source.reference must be specified. */
source: Source;
/** The code locations of the breakpoints. */
breakpoints?: SourceBreakpoint[];
/** Deprecated: The code locations of the breakpoints. */
lines?: number[];
}
/** Response to "setBreakpoints" request.
Returned is information about each breakpoint created by this request.
This includes the actual code location and whether the breakpoint could be verified.
*/
export interface SetBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */
breakpoints: Breakpoint[];
};
}
/** SetFunctionBreakpoints request; value of command field is "setFunctionBreakpoints".
Sets multiple function breakpoints and clears all previous function breakpoints.
To clear all function breakpoint, specify an empty array.
When a function breakpoint is hit, a StoppedEvent (event type 'function breakpoint') is generated.
*/
export interface SetFunctionBreakpointsRequest extends Request {
arguments: SetFunctionBreakpointsArguments;
}
/** Arguments for "setFunctionBreakpoints" request. */
export interface SetFunctionBreakpointsArguments {
/** The function names of the breakpoints. */
breakpoints: FunctionBreakpoint[];
}
/** Response to "setFunctionBreakpoints" request.
Returned is information about each breakpoint created by this request.
*/
export interface SetFunctionBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
breakpoints: Breakpoint[];
};
}
/** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
*/
export interface SetExceptionBreakpointsRequest extends Request {
arguments: SetExceptionBreakpointsArguments;
}
/** Arguments for "setExceptionBreakpoints" request. */
export interface SetExceptionBreakpointsArguments {
/** Names of enabled exception breakpoints. */
filters: string[];
}
/** Response to "setExceptionBreakpoints" request. This is just an acknowledgement, so no body field is required. */
export interface SetExceptionBreakpointsResponse extends Response {
}
/** Continue request; value of command field is "continue".
The request starts the debuggee to run again.
*/
export interface ContinueRequest extends Request {
arguments: ContinueArguments;
}
/** Arguments for "continue" request. */
export interface ContinueArguments {
/** continue execution for this thread. */
threadId: number;
}
/** Response to "continue" request. This is just an acknowledgement, so no body field is required. */
export interface ContinueResponse extends Response {
}
/** Next request; value of command field is "next".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface NextRequest extends Request {
arguments: NextArguments;
}
/** Arguments for "next" request. */
export interface NextArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "next" request. This is just an acknowledgement, so no body field is required. */
export interface NextResponse extends Response {
}
/** StepIn request; value of command field is "stepIn".
The request starts the debuggee to run again for one step.
The debug adapter will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepInRequest extends Request {
arguments: StepInArguments;
}
/** Arguments for "stepIn" request. */
export interface StepInArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepIn" request. This is just an acknowledgement, so no body field is required. */
export interface StepInResponse extends Response {
}
/** StepOutIn request; value of command field is "stepOut".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepOutRequest extends Request {
arguments: StepOutArguments;
}
/** Arguments for "stepOut" request. */
export interface StepOutArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepOut" request. This is just an acknowledgement, so no body field is required. */
export interface StepOutResponse extends Response {
}
/** Pause request; value of command field is "pause".
The request suspenses the debuggee.
penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command.
*/
export interface PauseRequest extends Request {
arguments: PauseArguments;
}
/** Arguments for "pause" request. */
export interface PauseArguments {
/** Pause execution for this thread. */
threadId: number;
}
/** Response to "pause" request. This is just an acknowledgement, so no body field is required. */
export interface PauseResponse extends Response {
}
/** StackTrace request; value of command field is "stackTrace".
The request returns a stacktrace from the current execution state.
*/
export interface StackTraceRequest extends Request {
arguments: StackTraceArguments;
}
/** Arguments for "stackTrace" request. */
export interface StackTraceArguments {
/** Retrieve the stacktrace for this thread. */
threadId: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
}
/** Response to "stackTrace" request. */
export interface StackTraceResponse extends Response {
body: {
/** The frames of the stackframe. If the array has length zero, there are no stackframes available.
This means that there is no location information available. */
stackFrames: StackFrame[];
};
}
/** Scopes request; value of command field is "scopes".
The request returns the variable scopes for a given stackframe ID.
*/
export interface ScopesRequest extends Request {
arguments: ScopesArguments;
}
/** Arguments for "scopes" request. */
export interface ScopesArguments {
/** Retrieve the scopes for this stackframe. */
frameId: number;
}
/** Response to "scopes" request. */
export interface ScopesResponse extends Response {
body: {
/** The scopes of the stackframe. If the array has length zero, there are no scopes available. */
scopes: Scope[];
};
}
/** Variables request; value of command field is "variables".
Retrieves all children for the given variable reference.
*/
export interface VariablesRequest extends Request {
arguments: VariablesArguments;
}
/** Arguments for "variables" request. */
export interface VariablesArguments {
/** The Variable reference. */
variablesReference: number;
}
/** Response to "variables" request. */
export interface VariablesResponse extends Response {
body: {
/** All children for the given variable reference */
variables: Variable[];
};
}
/** Source request; value of command field is "source".
The request retrieves the source code for a given source reference.
*/
export interface SourceRequest extends Request {
arguments: SourceArguments;
}
/** Arguments for "source" request. */
export interface SourceArguments {
/** The reference to the source. This is the value received in Source.reference. */
sourceReference: number;
}
/** Response to "source" request. */
export interface SourceResponse extends Response {
body: {
/** Content of the source reference */
content: string;
};
}
/** Thread request; value of command field is "threads".
The request retrieves a list of all threads.
*/
export interface ThreadsRequest extends Request {
}
/** Response to "threads" request. */
export interface ThreadsResponse extends Response {
body: {
/** All threads. */
threads: Thread[];
};
}
/** Evaluate request; value of command field is "evaluate".
Evaluates the given expression in the context of the top most stack frame.
The expression has access to any variables and arguments that are in scope.
*/
export interface EvaluateRequest extends Request {
arguments: EvaluateArguments;
}
/** Arguments for "evaluate" request. */
export interface EvaluateArguments {
/** The expression to evaluate. */
expression: string;
/** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
}
/** Response to "evaluate" request. */
export interface EvaluateResponse extends Response {
body: {
/** The result of the evaluate. */
result: string;
/** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest */
variablesReference: number;
};
}
//---- Types
/** Information about the capabilities of a debug adapter. */
export interface Capabilites {
/** The debug adapter supports the configurationDoneRequest. */
supportsConfigurationDoneRequest?: boolean;
/** The debug adapter supports functionBreakpoints. */
supportsFunctionBreakpoints?: boolean;
/** The debug adapter supports conditionalBreakpoints. */
supportsConditionalBreakpoints?: boolean;
/** The debug adapter supports a (side effect free) evaluate request for data hovers. */
supportsEvaluateForHovers?: boolean;
/** Available filters for the setExceptionBreakpoints request. */
exceptionBreakpointFilters?: [
{
filter: string,
label: string
}
]
}
/** A structured message object. Used to return errors from requests. */
export interface Message {
/** Unique identifier for the message. */
id: number;
/** A format string for the message. Embedded variables have the form '{name}'.
If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. */
format: string;
/** An object used as a dictionary for looking up the variables in the format string. */
variables?: { [key: string]: string };
/** if true send to telemetry */
sendTelemetry?: boolean;
/** if true show user */
showUser?: boolean;
}
/** A Thread */
export interface Thread {
/** Unique identifier for the thread. */
id: number;
/** A name of the thread. */
name: string;
}
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
/** The long (absolute) path of the source. It is not guaranteed that the source exists at this location. */
path?: string;
/** If sourceReference > 0 the contents of the source can be retrieved through the SourceRequest. A sourceReference is only valid for a session, so it must not be used to persist a source. */
sourceReference?: number;
/** The (optional) origin of this source: possible values "internal module", "inlined content from source map", etc. */
origin?: string;
/** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */
adapterData?: any;
}
/** A Stackframe contains the source location. */
export interface StackFrame {
/** An identifier for the stack frame. This id can be used to retrieve the scopes of the frame with the 'scopesRequest'. */
id: number;
/** The name of the stack frame, typically a method name */
name: string;
/** The optional source of the frame. */
source?: Source;
/** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */
line: number;
/** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */
column: number;
}
/** A Scope is a named container for variables. */
export interface Scope {
/** name of the scope (as such 'Arguments', 'Locals') */
name: string;
/** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */
variablesReference: number;
/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
/** A Variable is a name/value pair.
If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest.
*/
export interface Variable {
/** The variable's name */
name: string;
/** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
value: string;
/** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
variablesReference: number;
}
/** Properties of a breakpoint passed to the setBreakpoints request.
*/
export interface SourceBreakpoint {
/** The source line of the breakpoint. */
line: number;
/** An optional source column of the breakpoint. */
column?: number;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Properties of a breakpoint passed to the setFunctionBreakpoints request.
*/
export interface FunctionBreakpoint {
/** The name of the function. */
name: string;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.
*/
export interface Breakpoint {
/** An optional unique identifier for the breakpoint. */
id?: number;
/** If true breakpoint could be set (but not necessarily at the desired location). */
verified: boolean;
/** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */
message?: string;
/** The source where the breakpoint is located. */
source?: Source;
/** The actual line of the breakpoint. */
line?: number;
/** The actual column of the breakpoint. */
column?: number;
}
}
| src/vs/workbench/parts/debug/common/debugProtocol.d.ts | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.9442158341407776,
0.0640772134065628,
0.00016093082376755774,
0.0007571745081804693,
0.2189895659685135
] |
{
"id": 5,
"code_window": [
"\t\tlines?: number[];\n",
"\t}\n",
"\t/** Response to \"setBreakpoints\" request.\n",
"\t\tReturned is information about each breakpoint created by this request.\n",
"\t\tThis includes the actual code location and whether the breakpoint could be verified.\n",
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThe breakpoints returned are in the same order as the elements of the 'breakpoints'\n",
"\t\t(or the deprecated 'lines') in the SetBreakpointsArguments.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"edit_start_line_idx": 240
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import platform = require('vs/platform/platform');
import typescript = require('vs/languages/typescript/common/typescript');
import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import ts = require('vs/languages/typescript/common/lib/typescriptServices');
export namespace Defaults {
export const ProjectResolver = new typescript.DefaultProjectResolver();
export function addExtraLib(content: string, filePath?:string): void {
ProjectResolver.addExtraLib(content, filePath);
}
export function setCompilerOptions(options: ts.CompilerOptions): void {
ProjectResolver.setCompilerOptions(options);
}
}
// ----- JavaScript extension ---------------------------------------------------------------
export namespace Extensions {
export var Identifier = 'javascript';
platform.Registry.add(Identifier, Extensions);
var projectResolver: AsyncDescriptor<typescript.IProjectResolver2>;
export function setProjectResolver(desc: AsyncDescriptor<typescript.IProjectResolver2>): void {
projectResolver = desc;
}
export function getProjectResolver(): AsyncDescriptor<typescript.IProjectResolver2> {
return projectResolver;
}
}
| src/vs/languages/javascript/common/javascript.extensions.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017386330000590533,
0.0001708927156869322,
0.00016595299530308694,
0.0001721500011626631,
0.0000029342479592742166
] |
{
"id": 5,
"code_window": [
"\t\tlines?: number[];\n",
"\t}\n",
"\t/** Response to \"setBreakpoints\" request.\n",
"\t\tReturned is information about each breakpoint created by this request.\n",
"\t\tThis includes the actual code location and whether the breakpoint could be verified.\n",
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThe breakpoints returned are in the same order as the elements of the 'breakpoints'\n",
"\t\t(or the deprecated 'lines') in the SetBreakpointsArguments.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"edit_start_line_idx": 240
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module winreg {
export interface IRegValue {
host: string;
hive: any;
key: string;
name: string;
type: string;
value: any;
}
export interface IWinRegConfig {
hive: any;
key: string;
}
export interface IRegValuesCallback {
(error: Error, items: IRegValue[]): void;
}
export interface IWinReg {
/**
* list the values under this key
*/
values(callback: IRegValuesCallback): void;
/**
* list the subkeys of this key
*/
keys(callback: (error:Error, keys: string[])=> void): void;
/**
* gets a value by it's name
*/
get(name: string, callback: (error: Error, item: IRegValue)=> void): void;
/**
* sets a value
*/
set(name:string, type: string, value: string, callback: (error:string) => void): void;
/**
* remove the value with the given key
*/
remove(name: string, callback: (error: void) => void): void;
/**
* create this key
*/
create(callback: (error:Error) => void): void;
/**
* remove this key
*/
erase(callback: (error:Error)=> void): void;
/**
* a new Winreg instance initialized with the parent ke
*/
parent: IWinReg;
host: string;
hive: string;
key: string;
path: string;
}
export interface IWinRegFactory {
new(config: IWinRegConfig): IWinReg;
// hives
HKLM: string;
HKCU: string;
HKCR: string;
HKCC: string;
HKU: string;
// types
REG_SZ: string;
REG_MULTI_SZ: string;
REG_EXPAND_SZ: string;
REG_DWORD: string;
REG_QWORD: string;
REG_BINARY: string;
REG_NONE: string;
}
}
declare module 'winreg' {
var winreg: winreg.IWinRegFactory;
export = winreg;
} | src/typings/winreg.d.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0001735451223794371,
0.0001675641251495108,
0.00016106621478684247,
0.00016684678848832846,
0.0000036924423056916567
] |
{
"id": 5,
"code_window": [
"\t\tlines?: number[];\n",
"\t}\n",
"\t/** Response to \"setBreakpoints\" request.\n",
"\t\tReturned is information about each breakpoint created by this request.\n",
"\t\tThis includes the actual code location and whether the breakpoint could be verified.\n",
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tThe breakpoints returned are in the same order as the elements of the 'breakpoints'\n",
"\t\t(or the deprecated 'lines') in the SetBreakpointsArguments.\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"edit_start_line_idx": 240
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/languages/sass/common/sass.contribution';
import SASS = require('vs/languages/sass/common/sass');
import modesUtil = require('vs/editor/test/common/modesUtil');
import Modes = require('vs/editor/common/modes');
import * as sassTokenTypes from 'vs/languages/sass/common/sassTokenTypes';
suite('Sass Colorizer', () => {
var tokenizationSupport: Modes.ITokenizationSupport;
var assertOnEnter: modesUtil.IOnEnterAsserter;
setup((done) => {
modesUtil.load('sass').then(mode => {
tokenizationSupport = mode.tokenizationSupport;
assertOnEnter = modesUtil.createOnEnterAsserter(mode.getId(), mode.richEditSupport);
done();
});
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
// Nested Rules
[{
line: '#main {\n width: 97%;\n p, div {\n font-size: 2em;\n a { font-weight: bold; }\n }\n pre { font-size: 3em; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'punctuation.curly.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 10, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'constant.numeric.sass' },
{ startIndex: 20, type: 'punctuation.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 24, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'punctuation.curly.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 37, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'constant.numeric.sass' },
{ startIndex: 51, type: 'punctuation.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'punctuation.curly.sass' },
{ startIndex: 60, type: '' },
{ startIndex: 61, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 78, type: 'punctuation.sass' },
{ startIndex: 79, type: '' },
{ startIndex: 80, type: 'punctuation.curly.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 92, type: 'punctuation.curly.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'constant.numeric.sass' },
{ startIndex: 108, type: 'punctuation.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' }
]}],
// Parent selector
[{
line: '#main {\n color: black;\n a {\n font-weight: bold;\n &:hover { color: red; }\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'punctuation.curly.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 10, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 22, type: 'punctuation.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 26, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 34, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 51, type: 'punctuation.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR_TAG + '.sass' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.curly.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 77, type: 'punctuation.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'punctuation.curly.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' }
]}],
// Nested Properties
[{
line: '.funky {\n font: 2px/3px {\n family: fantasy;\n size: 30em;\n weight: bold;\n }\n color: black;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'constant.numeric.sass' },
{ startIndex: 20, type: 'keyword.operator.sass' },
{ startIndex: 21, type: 'constant.numeric.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 46, type: 'punctuation.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 52, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 58, type: 'constant.numeric.sass' },
{ startIndex: 62, type: 'punctuation.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 68, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 75, type: '' },
{ startIndex: 76, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 80, type: 'punctuation.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 95, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 100, type: 'punctuation.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'punctuation.curly.sass' }
]}],
// Nesting name conflicts
[{
line: 'tr.default {\n foo: { // properties\n foo : 1;\n }\n foo: 1px; // rule\n foo.bar { // selector\n foo : 1;\n }\n foo:bar { // selector\n foo : 1;\n }\n foo: 1px; // rule\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 15, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'punctuation.curly.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'comment.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'constant.numeric.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'constant.numeric.sass' },
{ startIndex: 63, type: 'punctuation.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'comment.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'comment.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 101, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'constant.numeric.sass' },
{ startIndex: 108, type: 'punctuation.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' },
{ startIndex: 113, type: '' },
{ startIndex: 116, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 123, type: '' },
{ startIndex: 124, type: 'punctuation.curly.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 126, type: 'comment.sass' },
{ startIndex: 137, type: '' },
{ startIndex: 142, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'constant.numeric.sass' },
{ startIndex: 149, type: 'punctuation.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: 'punctuation.curly.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 161, type: '' },
{ startIndex: 162, type: 'constant.numeric.sass' },
{ startIndex: 165, type: 'punctuation.sass' },
{ startIndex: 166, type: '' },
{ startIndex: 167, type: 'comment.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: 'punctuation.curly.sass' }
]}],
// Missing semicolons
[{
line: 'tr.default {\n foo.bar {\n $foo: 1px\n }\n foo: {\n foo : white\n }\n foo.bar1 {\n @extend tr.default\n }\n foo.bar2 {\n @import "compass"\n }\n bar: black\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 15, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'punctuation.curly.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 29, type: 'variable.decl.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'constant.numeric.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 45, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'punctuation.curly.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 56, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 67, type: '' },
{ startIndex: 70, type: 'punctuation.curly.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 97, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 114, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 122, type: '' },
{ startIndex: 123, type: 'punctuation.curly.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 129, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 136, type: '' },
{ startIndex: 137, type: 'string.punctuation.sass' },
{ startIndex: 138, type: 'string.sass' },
{ startIndex: 145, type: 'string.punctuation.sass' },
{ startIndex: 146, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 157, type: '' },
{ startIndex: 158, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 163, type: '' },
{ startIndex: 164, type: 'punctuation.curly.sass' }
]}],
// Rules without whitespaces
[{
line: 'legend {foo{a:s}margin-top:0;margin-bottom:#123;margin-top:s(1)}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 14, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 15, type: 'punctuation.curly.sass' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 27, type: 'constant.numeric.sass' },
{ startIndex: 28, type: 'punctuation.sass' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 43, type: 'constant.rgb-value.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 59, type: 'support.function.name.sass' },
{ startIndex: 61, type: 'constant.numeric.sass' },
{ startIndex: 62, type: 'support.function.name.sass' },
{ startIndex: 63, type: 'punctuation.curly.sass' }
]}],
// Extended comments
[{
line: '/* extended comment syntax */\n/* This comment is\n * several lines long.\n * since it uses the CSS comment syntax,\n * it will appear in the CSS output. */\nbody { color: black; }\n\n// These comments are only one line long each.\n// They won\'t appear in the CSS output,\n// since they use the single-line comment syntax.\na { color: green; }',
tokens: [
{ startIndex: 0, type: 'comment.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'comment.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'comment.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'comment.sass' },
{ startIndex: 112, type: '' },
{ startIndex: 113, type: 'comment.sass' },
{ startIndex: 152, type: '' },
{ startIndex: 153, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 157, type: '' },
{ startIndex: 158, type: 'punctuation.curly.sass' },
{ startIndex: 159, type: '' },
{ startIndex: 160, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 166, type: '' },
{ startIndex: 167, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 172, type: 'punctuation.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'punctuation.curly.sass' },
{ startIndex: 175, type: '' },
{ startIndex: 177, type: 'comment.sass' },
{ startIndex: 223, type: '' },
{ startIndex: 224, type: 'comment.sass' },
{ startIndex: 263, type: '' },
{ startIndex: 264, type: 'comment.sass' },
{ startIndex: 313, type: '' },
{ startIndex: 314, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 315, type: '' },
{ startIndex: 316, type: 'punctuation.curly.sass' },
{ startIndex: 317, type: '' },
{ startIndex: 318, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 324, type: '' },
{ startIndex: 325, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 330, type: 'punctuation.sass' },
{ startIndex: 331, type: '' },
{ startIndex: 332, type: 'punctuation.curly.sass' }
]}],
// Variable declarations and references
[{
line: '$width: 5em;\n$width: "Second width?" !default;\n#main {\n $localvar: 6em;\n width: $width;\n\n $font-size: 12px;\n $line-height: 30px;\n font: #{$font-size}/#{$line-height};\n}\n$name: foo;\n$attr: border;\np.#{$name} {\n #{$attr}-color: blue;\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'constant.numeric.sass' },
{ startIndex: 11, type: 'punctuation.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'variable.decl.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'string.punctuation.sass' },
{ startIndex: 22, type: 'string.sass' },
{ startIndex: 35, type: 'string.punctuation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'literal.sass' },
{ startIndex: 45, type: 'punctuation.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 53, type: 'punctuation.curly.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 57, type: 'variable.decl.sass' },
{ startIndex: 67, type: '' },
{ startIndex: 68, type: 'constant.numeric.sass' },
{ startIndex: 71, type: 'punctuation.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'variable.ref.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 93, type: 'variable.decl.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'constant.numeric.sass' },
{ startIndex: 109, type: 'punctuation.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 113, type: 'variable.decl.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'constant.numeric.sass' },
{ startIndex: 131, type: 'punctuation.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 135, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 140, type: '' },
{ startIndex: 141, type: 'support.function.interpolation.sass' },
{ startIndex: 143, type: 'variable.ref.sass' },
{ startIndex: 153, type: 'support.function.interpolation.sass' },
{ startIndex: 154, type: 'keyword.operator.sass' },
{ startIndex: 155, type: 'support.function.interpolation.sass' },
{ startIndex: 157, type: 'variable.ref.sass' },
{ startIndex: 169, type: 'support.function.interpolation.sass' },
{ startIndex: 170, type: 'punctuation.sass' },
{ startIndex: 171, type: '' },
{ startIndex: 172, type: 'punctuation.curly.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'variable.decl.sass' },
{ startIndex: 180, type: '' },
{ startIndex: 181, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 184, type: 'punctuation.sass' },
{ startIndex: 185, type: '' },
{ startIndex: 186, type: 'variable.decl.sass' },
{ startIndex: 192, type: '' },
{ startIndex: 193, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 199, type: 'punctuation.sass' },
{ startIndex: 200, type: '' },
{ startIndex: 201, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 203, type: 'support.function.interpolation.sass' },
{ startIndex: 205, type: 'variable.ref.sass' },
{ startIndex: 210, type: 'support.function.interpolation.sass' },
{ startIndex: 211, type: '' },
{ startIndex: 212, type: 'punctuation.curly.sass' },
{ startIndex: 213, type: '' },
{ startIndex: 216, type: 'support.function.interpolation.sass' },
{ startIndex: 218, type: 'variable.ref.sass' },
{ startIndex: 223, type: 'support.function.interpolation.sass' },
{ startIndex: 224, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 231, type: '' },
{ startIndex: 232, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 236, type: 'punctuation.sass' },
{ startIndex: 237, type: '' },
{ startIndex: 238, type: 'punctuation.curly.sass' }
]}],
// Variable declaration with whitespaces
[{
line: '// Set the color of your columns\n$grid-background-column-color : rgba(100, 100, 225, 0.25) !default;',
tokens: [
{ startIndex: 0, type: 'comment.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 33, type: 'variable.decl.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'support.function.name.sass' },
{ startIndex: 74, type: 'constant.numeric.sass' },
{ startIndex: 77, type: 'punctuation.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'constant.numeric.sass' },
{ startIndex: 82, type: 'punctuation.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'constant.numeric.sass' },
{ startIndex: 87, type: 'punctuation.sass' },
{ startIndex: 88, type: '' },
{ startIndex: 89, type: 'constant.numeric.sass' },
{ startIndex: 93, type: 'support.function.name.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 97, type: 'literal.sass' },
{ startIndex: 105, type: 'punctuation.sass' }
]}],
// Operations
[{
line: 'p {\n width: (1em + 2em) * 3;\n color: #010203 + #040506;\n font-family: sans- + "serif";\n margin: 3px + 4px auto;\n content: "I ate #{5 + 10} pies!";\n color: hsl(0, 100%, 50%);\n color: hsl($hue: 0, $saturation: 100%, $lightness: 50%);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'punctuation.curly.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 6, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'punctuation.parenthesis.sass' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'keyword.operator.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'constant.numeric.sass' },
{ startIndex: 23, type: 'punctuation.parenthesis.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'keyword.operator.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'constant.numeric.sass' },
{ startIndex: 28, type: 'punctuation.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 32, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'constant.rgb-value.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'keyword.operator.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'constant.rgb-value.sass' },
{ startIndex: 56, type: 'punctuation.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 60, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'keyword.operator.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 81, type: 'string.punctuation.sass' },
{ startIndex: 82, type: 'string.sass' },
{ startIndex: 87, type: 'string.punctuation.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 92, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 100, type: 'constant.numeric.sass' },
{ startIndex: 103, type: '' },
{ startIndex: 104, type: 'keyword.operator.sass' },
{ startIndex: 105, type: '' },
{ startIndex: 106, type: 'constant.numeric.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 114, type: 'punctuation.sass' },
{ startIndex: 115, type: '' },
{ startIndex: 118, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'string.punctuation.sass' },
{ startIndex: 128, type: 'string.sass' },
{ startIndex: 149, type: 'string.punctuation.sass' },
{ startIndex: 150, type: 'punctuation.sass' },
{ startIndex: 151, type: '' },
{ startIndex: 154, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 161, type: 'support.function.name.sass' },
{ startIndex: 165, type: 'constant.numeric.sass' },
{ startIndex: 166, type: 'punctuation.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 168, type: 'constant.numeric.sass' },
{ startIndex: 172, type: 'punctuation.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'constant.numeric.sass' },
{ startIndex: 177, type: 'support.function.name.sass' },
{ startIndex: 178, type: 'punctuation.sass' },
{ startIndex: 179, type: '' },
{ startIndex: 182, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'support.function.name.sass' },
{ startIndex: 193, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'constant.numeric.sass' },
{ startIndex: 200, type: 'punctuation.sass' },
{ startIndex: 201, type: '' },
{ startIndex: 202, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 214, type: '' },
{ startIndex: 215, type: 'constant.numeric.sass' },
{ startIndex: 219, type: 'punctuation.sass' },
{ startIndex: 220, type: '' },
{ startIndex: 221, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 232, type: '' },
{ startIndex: 233, type: 'constant.numeric.sass' },
{ startIndex: 236, type: 'support.function.name.sass' },
{ startIndex: 237, type: 'punctuation.sass' },
{ startIndex: 238, type: '' },
{ startIndex: 239, type: 'punctuation.curly.sass' }
]}],
// Function
[{
line: '$grid-width: 40px;\n$gutter-width: 10px;\n@function grid-width($n) {\n @return $n * $grid-width + ($n - 1) * $gutter-width;\n}\n#sidebar { width: grid-width(5); }',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'constant.numeric.sass' },
{ startIndex: 17, type: 'punctuation.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'variable.decl.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'constant.numeric.sass' },
{ startIndex: 38, type: 'punctuation.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'support.function.name.sass' },
{ startIndex: 61, type: 'variable.ref.sass' },
{ startIndex: 63, type: 'support.function.name.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.curly.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 69, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: 'variable.ref.sass' },
{ startIndex: 79, type: '' },
{ startIndex: 80, type: 'keyword.operator.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'variable.ref.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: 'keyword.operator.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'punctuation.parenthesis.sass' },
{ startIndex: 97, type: 'variable.ref.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 100, type: 'keyword.operator.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'constant.numeric.sass' },
{ startIndex: 103, type: 'punctuation.parenthesis.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'keyword.operator.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'variable.ref.sass' },
{ startIndex: 120, type: 'punctuation.sass' },
{ startIndex: 121, type: '' },
{ startIndex: 122, type: 'punctuation.curly.sass' },
{ startIndex: 123, type: '' },
{ startIndex: 124, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 133, type: 'punctuation.curly.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 135, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'support.function.name.sass' },
{ startIndex: 153, type: 'constant.numeric.sass' },
{ startIndex: 154, type: 'support.function.name.sass' },
{ startIndex: 155, type: 'punctuation.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'punctuation.curly.sass' }
]}],
// Imports
[{
line: '@import "foo.scss";\n$family: unquote("Droid+Sans");\n@import "rounded-corners" url("http://fonts.googleapis.com/css?family=#{$family}");\n#main {\n @import "example";\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'string.punctuation.sass' },
{ startIndex: 9, type: 'string.sass' },
{ startIndex: 17, type: 'string.punctuation.sass' },
{ startIndex: 18, type: 'punctuation.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'variable.decl.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'support.function.name.sass' },
{ startIndex: 37, type: 'string.punctuation.sass' },
{ startIndex: 38, type: 'string.sass' },
{ startIndex: 48, type: 'string.punctuation.sass' },
{ startIndex: 49, type: 'support.function.name.sass' },
{ startIndex: 50, type: 'punctuation.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'string.punctuation.sass' },
{ startIndex: 61, type: 'string.sass' },
{ startIndex: 76, type: 'string.punctuation.sass' },
{ startIndex: 77, type: '' },
{ startIndex: 78, type: 'support.function.name.sass' },
{ startIndex: 82, type: 'string.punctuation.sass' },
{ startIndex: 83, type: 'string.sass' },
{ startIndex: 132, type: 'string.punctuation.sass' },
{ startIndex: 133, type: 'support.function.name.sass' },
{ startIndex: 134, type: 'punctuation.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 136, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'punctuation.curly.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 146, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 153, type: '' },
{ startIndex: 154, type: 'string.punctuation.sass' },
{ startIndex: 155, type: 'string.sass' },
{ startIndex: 162, type: 'string.punctuation.sass' },
{ startIndex: 163, type: 'punctuation.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'punctuation.curly.sass' }
]}],
// Media
[{
line: '.sidebar {\n width: 300px;\n @media screen and (orientation: landscape) {\n width: 500px;\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'punctuation.curly.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'constant.numeric.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'keyword.operator.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'punctuation.parenthesis.sass' },
{ startIndex: 48, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 61, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 70, type: 'punctuation.parenthesis.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'constant.numeric.sass' },
{ startIndex: 90, type: 'punctuation.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 94, type: 'punctuation.curly.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'punctuation.curly.sass' }
]}],
// Extend
[{
line: '.error {\n border: 1px #f00;\n background-color: #fdd;\n}\n.seriousError {\n @extend .error;\n border-width: 3px;\n}\n#context a%extreme {\n color: blue;\n font-weight: bold;\n font-size: 2em;\n}\n.notice {\n @extend %extreme !optional;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'constant.rgb-value.sass' },
{ startIndex: 27, type: 'punctuation.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'constant.rgb-value.sass' },
{ startIndex: 53, type: 'punctuation.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'punctuation.curly.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 89, type: 'punctuation.sass' },
{ startIndex: 90, type: '' },
{ startIndex: 93, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'constant.numeric.sass' },
{ startIndex: 110, type: 'punctuation.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' },
{ startIndex: 113, type: '' },
{ startIndex: 114, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 122, type: '' },
{ startIndex: 123, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 133, type: 'punctuation.curly.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 137, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 144, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 148, type: 'punctuation.sass' },
{ startIndex: 149, type: '' },
{ startIndex: 152, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 173, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 183, type: '' },
{ startIndex: 184, type: 'constant.numeric.sass' },
{ startIndex: 187, type: 'punctuation.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'punctuation.curly.sass' },
{ startIndex: 190, type: '' },
{ startIndex: 191, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'punctuation.curly.sass' },
{ startIndex: 200, type: '' },
{ startIndex: 203, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 210, type: '' },
{ startIndex: 211, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 219, type: '' },
{ startIndex: 220, type: 'literal.sass' },
{ startIndex: 229, type: 'punctuation.sass' },
{ startIndex: 230, type: '' },
{ startIndex: 231, type: 'punctuation.curly.sass' }
]}],
// @debug and @warn
[{
line: '@debug 10em + 12em;\n@mixin adjust-location($x, $y) {\n @if unitless($x) {\n @warn "Assuming #{$x} to be in pixels";\n $x: 1px * $x;\n }\n @if unitless($y) {\n @warn "Assuming #{$y} to be in pixels";\n $y: 1px * $y;\n }\n position: relative; left: $x; top: $y;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'constant.numeric.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'keyword.operator.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 18, type: 'punctuation.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'support.function.name.sass' },
{ startIndex: 43, type: 'variable.ref.sass' },
{ startIndex: 45, type: 'punctuation.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'variable.ref.sass' },
{ startIndex: 49, type: 'support.function.name.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'support.function.name.sass' },
{ startIndex: 68, type: 'variable.ref.sass' },
{ startIndex: 70, type: 'support.function.name.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'string.punctuation.sass' },
{ startIndex: 85, type: 'string.sass' },
{ startIndex: 115, type: 'string.punctuation.sass' },
{ startIndex: 116, type: 'punctuation.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 122, type: 'variable.decl.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 126, type: 'constant.numeric.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'keyword.operator.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 132, type: 'variable.ref.sass' },
{ startIndex: 134, type: 'punctuation.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 138, type: 'punctuation.curly.sass' },
{ startIndex: 139, type: '' },
{ startIndex: 142, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 145, type: '' },
{ startIndex: 146, type: 'support.function.name.sass' },
{ startIndex: 155, type: 'variable.ref.sass' },
{ startIndex: 157, type: 'support.function.name.sass' },
{ startIndex: 158, type: '' },
{ startIndex: 159, type: 'punctuation.curly.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 165, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'string.punctuation.sass' },
{ startIndex: 172, type: 'string.sass' },
{ startIndex: 202, type: 'string.punctuation.sass' },
{ startIndex: 203, type: 'punctuation.sass' },
{ startIndex: 204, type: '' },
{ startIndex: 209, type: 'variable.decl.sass' },
{ startIndex: 212, type: '' },
{ startIndex: 213, type: 'constant.numeric.sass' },
{ startIndex: 216, type: '' },
{ startIndex: 217, type: 'keyword.operator.sass' },
{ startIndex: 218, type: '' },
{ startIndex: 219, type: 'variable.ref.sass' },
{ startIndex: 221, type: 'punctuation.sass' },
{ startIndex: 222, type: '' },
{ startIndex: 225, type: 'punctuation.curly.sass' },
{ startIndex: 226, type: '' },
{ startIndex: 229, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 238, type: '' },
{ startIndex: 239, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 247, type: 'punctuation.sass' },
{ startIndex: 248, type: '' },
{ startIndex: 249, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 254, type: '' },
{ startIndex: 255, type: 'variable.ref.sass' },
{ startIndex: 257, type: 'punctuation.sass' },
{ startIndex: 258, type: '' },
{ startIndex: 259, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 263, type: '' },
{ startIndex: 264, type: 'variable.ref.sass' },
{ startIndex: 266, type: 'punctuation.sass' },
{ startIndex: 267, type: '' },
{ startIndex: 268, type: 'punctuation.curly.sass' }
]}],
// if statement
[{
line: 'p {\n @if 1 + 1 == 2 { border: 1px solid; }\n @if 5 < 3 { border: 2px dotted; }\n @if null { border: 3px double; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'punctuation.curly.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 6, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'constant.numeric.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'keyword.operator.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'keyword.operator.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'punctuation.curly.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'constant.numeric.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 40, type: 'punctuation.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 43, type: 'punctuation.curly.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 47, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'constant.numeric.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 53, type: 'keyword.operator.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'constant.numeric.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'constant.numeric.sass' },
{ startIndex: 75, type: '' },
{ startIndex: 76, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 82, type: 'punctuation.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 92, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 103, type: 'punctuation.curly.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 112, type: '' },
{ startIndex: 113, type: 'constant.numeric.sass' },
{ startIndex: 116, type: '' },
{ startIndex: 117, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 123, type: 'punctuation.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 125, type: 'punctuation.curly.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'punctuation.curly.sass' }
]}],
// if-else statement
[{
line: '$type: monster;\np {\n @if $type == ocean {\n color: blue;\n } @else if $type == matador {\n color: red;\n } @else {\n color: black;\n }\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 14, type: 'punctuation.sass' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'punctuation.curly.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 22, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'variable.ref.sass' },
{ startIndex: 31, type: '' },
{ startIndex: 32, type: 'keyword.operator.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 58, type: 'punctuation.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 69, type: '' },
{ startIndex: 70, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: 'variable.ref.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'keyword.operator.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 90, type: 'punctuation.curly.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 102, type: '' },
{ startIndex: 103, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 106, type: 'punctuation.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 118, type: 'punctuation.curly.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 124, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 131, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 136, type: 'punctuation.sass' },
{ startIndex: 137, type: '' },
{ startIndex: 140, type: 'punctuation.curly.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'punctuation.curly.sass' }
]}],
// for statement
[{
line: '@for $i from 1 through 3 {\n .item-#{$i} { width: 2em * $i; }\n}',
tokens: [
{ startIndex: 0, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'variable.ref.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'constant.numeric.sass' },
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'constant.numeric.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 35, type: 'support.function.interpolation.sass' },
{ startIndex: 37, type: 'variable.ref.sass' },
{ startIndex: 39, type: 'support.function.interpolation.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'constant.numeric.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: 'keyword.operator.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'variable.ref.sass' },
{ startIndex: 58, type: 'punctuation.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'punctuation.curly.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' }
]}],
// each statement
[{
line: '@each $animal in puma, sea-slug, egret, salamander {\n .#{$animal}-icon {\n background-image: url(\'/images/#{$animal}.png\');\n }\n}',
tokens: [
{ startIndex: 0, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'variable.ref.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 21, type: 'keyword.operator.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 31, type: 'keyword.operator.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 33, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 38, type: 'keyword.operator.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 56, type: 'support.function.interpolation.sass' },
{ startIndex: 58, type: 'variable.ref.sass' },
{ startIndex: 65, type: 'support.function.interpolation.sass' },
{ startIndex: 66, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'support.function.name.sass' },
{ startIndex: 100, type: 'string.punctuation.sass' },
{ startIndex: 101, type: 'string.sass' },
{ startIndex: 123, type: 'string.punctuation.sass' },
{ startIndex: 124, type: 'support.function.name.sass' },
{ startIndex: 125, type: 'punctuation.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 129, type: 'punctuation.curly.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 131, type: 'punctuation.curly.sass' }
]}],
// while statement
[{
line: '$i: 6;\n@while $i > 0 {\n .item-#{$i} { width: 2em * $i; }\n $i: $i - 2;\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'constant.numeric.sass' },
{ startIndex: 5, type: 'punctuation.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'keyword.operator.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'punctuation.curly.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 25, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 31, type: 'support.function.interpolation.sass' },
{ startIndex: 33, type: 'variable.ref.sass' },
{ startIndex: 35, type: 'support.function.interpolation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'punctuation.curly.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'constant.numeric.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'keyword.operator.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'variable.ref.sass' },
{ startIndex: 54, type: 'punctuation.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'punctuation.curly.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 60, type: 'variable.decl.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'variable.ref.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: 'keyword.operator.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'constant.numeric.sass' },
{ startIndex: 70, type: 'punctuation.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' }
]}],
// Function with control statements nested
[{
line: '@function foo($total, $a) {\n @for $i from 0 to $total {\n @if (unit($a) == "%") and ($i == ($total - 1)) {\n $z: 100%;\n @return \'1\';\n }\n }\n @return $grid;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'support.function.name.sass' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 20, type: 'punctuation.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'variable.ref.sass' },
{ startIndex: 24, type: 'support.function.name.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'punctuation.curly.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 30, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'variable.ref.sass' },
{ startIndex: 37, type: '' },
{ startIndex: 38, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'constant.numeric.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 45, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'variable.ref.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 61, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.parenthesis.sass' },
{ startIndex: 66, type: 'support.function.name.sass' },
{ startIndex: 71, type: 'variable.ref.sass' },
{ startIndex: 73, type: 'support.function.name.sass' },
{ startIndex: 74, type: '' },
{ startIndex: 75, type: 'keyword.operator.sass' },
{ startIndex: 77, type: '' },
{ startIndex: 78, type: 'string.punctuation.sass' },
{ startIndex: 79, type: 'string.sass' },
{ startIndex: 80, type: 'string.punctuation.sass' },
{ startIndex: 81, type: 'punctuation.parenthesis.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'keyword.operator.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 87, type: 'punctuation.parenthesis.sass' },
{ startIndex: 88, type: 'variable.ref.sass' },
{ startIndex: 90, type: '' },
{ startIndex: 91, type: 'keyword.operator.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: 'punctuation.parenthesis.sass' },
{ startIndex: 95, type: 'variable.ref.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'keyword.operator.sass' },
{ startIndex: 103, type: '' },
{ startIndex: 104, type: 'constant.numeric.sass' },
{ startIndex: 105, type: 'punctuation.parenthesis.sass' },
{ startIndex: 106, type: 'punctuation.parenthesis.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 108, type: 'punctuation.curly.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 116, type: 'variable.decl.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 120, type: 'constant.numeric.sass' },
{ startIndex: 124, type: 'punctuation.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 132, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 139, type: '' },
{ startIndex: 140, type: 'string.punctuation.sass' },
{ startIndex: 141, type: 'string.sass' },
{ startIndex: 142, type: 'string.punctuation.sass' },
{ startIndex: 143, type: 'punctuation.sass' },
{ startIndex: 144, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: 'punctuation.curly.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'variable.ref.sass' },
{ startIndex: 170, type: 'punctuation.sass' },
{ startIndex: 171, type: '' },
{ startIndex: 172, type: 'punctuation.curly.sass' }
]}],
// @mixin simple
[{
line: '@mixin large-text {\n font: {\n family: Arial;\n size: 20px;\n weight: bold;\n }\n color: #ff0000;\n}\n.page-title {\n @include large-text;\n padding: 4px;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'punctuation.curly.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 22, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 34, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 42, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 53, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'constant.numeric.sass' },
{ startIndex: 63, type: 'punctuation.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 69, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 81, type: 'punctuation.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'constant.rgb-value.sass' },
{ startIndex: 103, type: 'punctuation.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'punctuation.curly.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 123, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 132, type: 'support.function.name.sass' },
{ startIndex: 142, type: 'punctuation.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 146, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 155, type: 'constant.numeric.sass' },
{ startIndex: 158, type: 'punctuation.sass' },
{ startIndex: 159, type: '' },
{ startIndex: 160, type: 'punctuation.curly.sass' }
]}],
// @mixin with parameters
[{
line: '@mixin sexy-border($color, $width: 1in) {\n border: {\n color: $color;\n width: $width;\n style: dashed;\n }\n}\np { @include sexy-border(blue); }',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 19, type: 'variable.ref.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'constant.numeric.sass' },
{ startIndex: 38, type: 'support.function.name.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: 'punctuation.curly.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 44, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'punctuation.curly.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'variable.ref.sass' },
{ startIndex: 71, type: 'punctuation.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 77, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'variable.ref.sass' },
{ startIndex: 90, type: 'punctuation.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 102, type: '' },
{ startIndex: 103, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 109, type: 'punctuation.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 113, type: 'punctuation.curly.sass' },
{ startIndex: 114, type: '' },
{ startIndex: 115, type: 'punctuation.curly.sass' },
{ startIndex: 116, type: '' },
{ startIndex: 117, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 121, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'support.function.name.sass' },
{ startIndex: 142, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 146, type: 'support.function.name.sass' },
{ startIndex: 147, type: 'punctuation.sass' },
{ startIndex: 148, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' }
]}],
// @mixin with varargs
[{
line: '@mixin box-shadow($shadows...) {\n -moz-box-shadow: $shadows;\n -webkit-box-shadow: $shadows;\n box-shadow: $shadows;\n}\n.shadows {\n @include box-shadow(0px 4px 5px #666, 2px 6px 10px #999);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 18, type: 'variable.ref.sass' },
{ startIndex: 26, type: 'keyword.operator.sass' },
{ startIndex: 29, type: 'support.function.name.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'punctuation.curly.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'variable.ref.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'variable.ref.sass' },
{ startIndex: 92, type: 'punctuation.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 108, type: 'variable.ref.sass' },
{ startIndex: 116, type: 'punctuation.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 118, type: 'punctuation.curly.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 120, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 128, type: '' },
{ startIndex: 129, type: 'punctuation.curly.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 133, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'support.function.name.sass' },
{ startIndex: 153, type: 'constant.numeric.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'constant.numeric.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 161, type: 'constant.numeric.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'constant.rgb-value.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'constant.numeric.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: 'constant.numeric.sass' },
{ startIndex: 178, type: '' },
{ startIndex: 179, type: 'constant.numeric.sass' },
{ startIndex: 183, type: '' },
{ startIndex: 184, type: 'constant.rgb-value.sass' },
{ startIndex: 188, type: 'support.function.name.sass' },
{ startIndex: 189, type: 'punctuation.sass' },
{ startIndex: 190, type: '' },
{ startIndex: 191, type: 'punctuation.curly.sass' }
]}],
// @include with varargs
[{
line: '@mixin colors($text, $background, $border) {\n color: $text;\n background-color: $background;\n border-color: $border;\n}\n$values: #ff0000, #00ff00, #0000ff;\n.primary {\n @include colors($values...);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 19, type: 'punctuation.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'variable.ref.sass' },
{ startIndex: 32, type: 'punctuation.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'variable.ref.sass' },
{ startIndex: 41, type: 'support.function.name.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'punctuation.curly.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: 'variable.ref.sass' },
{ startIndex: 59, type: 'punctuation.sass' },
{ startIndex: 60, type: '' },
{ startIndex: 63, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 81, type: 'variable.ref.sass' },
{ startIndex: 92, type: 'punctuation.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: 'variable.ref.sass' },
{ startIndex: 117, type: 'punctuation.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 121, type: 'variable.decl.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'constant.rgb-value.sass' },
{ startIndex: 137, type: 'keyword.operator.sass' },
{ startIndex: 138, type: '' },
{ startIndex: 139, type: 'constant.rgb-value.sass' },
{ startIndex: 146, type: 'keyword.operator.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'constant.rgb-value.sass' },
{ startIndex: 155, type: 'punctuation.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 165, type: '' },
{ startIndex: 166, type: 'punctuation.curly.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 170, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 178, type: '' },
{ startIndex: 179, type: 'support.function.name.sass' },
{ startIndex: 186, type: 'variable.ref.sass' },
{ startIndex: 193, type: 'keyword.operator.sass' },
{ startIndex: 196, type: 'support.function.name.sass' },
{ startIndex: 197, type: 'punctuation.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'punctuation.curly.sass' }
]}],
// @include with body
[{
line: '@mixin apply-to-ie6-only {\n * html {\n @content;\n }\n}\n@include apply-to-ie6-only {\n #logo {\n background-image: url(/logo.gif);\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_SELECTOR_TAG + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: 'punctuation.curly.sass' },
{ startIndex: 37, type: '' },
{ startIndex: 42, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 54, type: 'punctuation.curly.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'punctuation.curly.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: 'support.function.name.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 95, type: 'punctuation.curly.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 101, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'support.function.name.sass' },
{ startIndex: 123, type: 'string.sass' },
{ startIndex: 132, type: 'support.function.name.sass' },
{ startIndex: 133, type: 'punctuation.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 137, type: 'punctuation.curly.sass' },
{ startIndex: 138, type: '' },
{ startIndex: 139, type: 'punctuation.curly.sass' }
]}],
// CSS charset
[{
line: '@charset "UTF-8";',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'string.punctuation.sass' },
{ startIndex: 10, type: 'string.sass' },
{ startIndex: 15, type: 'string.punctuation.sass' },
{ startIndex: 16, type: 'punctuation.sass' }
]}],
// CSS attributes
[{
line: '[rel="external"]::after {\n content: \'s\';\n}',
tokens: [
{ startIndex: 0, type: 'punctuation.bracket.sass' },
{ startIndex: 1, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 4, type: 'keyword.operator.sass' },
{ startIndex: 5, type: 'string.punctuation.sass' },
{ startIndex: 6, type: 'string.sass' },
{ startIndex: 14, type: 'string.punctuation.sass' },
{ startIndex: 15, type: 'punctuation.bracket.sass' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'punctuation.curly.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 30, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'string.punctuation.sass' },
{ startIndex: 40, type: 'string.sass' },
{ startIndex: 41, type: 'string.punctuation.sass' },
{ startIndex: 42, type: 'punctuation.sass' },
{ startIndex: 43, type: '' },
{ startIndex: 44, type: 'punctuation.curly.sass' }
]}],
// CSS @page
[{
line: '@page :left {\n margin-left: 4cm;\n margin-right: 3cm;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'punctuation.curly.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'constant.numeric.sass' },
{ startIndex: 32, type: 'punctuation.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'constant.numeric.sass' },
{ startIndex: 53, type: 'punctuation.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' }
]}],
// Extend with interpolation variable
[{
line: '@mixin error($a: false) {\n @extend .#{$a};\n @extend ##{$a};\n}\n#bar {a: 1px;}\n.bar {b: 1px;}\nfoo {\n @include error(\'bar\'); \n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 22, type: 'support.function.name.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'punctuation.curly.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 28, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 37, type: 'support.function.interpolation.sass' },
{ startIndex: 39, type: 'variable.ref.sass' },
{ startIndex: 41, type: 'support.function.interpolation.sass' },
{ startIndex: 42, type: 'punctuation.sass' },
{ startIndex: 43, type: '' },
{ startIndex: 46, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 55, type: 'support.function.interpolation.sass' },
{ startIndex: 57, type: 'variable.ref.sass' },
{ startIndex: 59, type: 'support.function.interpolation.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'punctuation.curly.sass' },
{ startIndex: 70, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: 'constant.numeric.sass' },
{ startIndex: 76, type: 'punctuation.sass' },
{ startIndex: 77, type: 'punctuation.curly.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 87, type: '' },
{ startIndex: 88, type: 'constant.numeric.sass' },
{ startIndex: 91, type: 'punctuation.sass' },
{ startIndex: 92, type: 'punctuation.curly.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 97, type: '' },
{ startIndex: 98, type: 'punctuation.curly.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 102, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 111, type: 'support.function.name.sass' },
{ startIndex: 117, type: 'string.punctuation.sass' },
{ startIndex: 118, type: 'string.sass' },
{ startIndex: 121, type: 'string.punctuation.sass' },
{ startIndex: 122, type: 'support.function.name.sass' },
{ startIndex: 123, type: 'punctuation.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 128, type: 'punctuation.curly.sass' }
]}],
// @font-face
[{
line: '@font-face { font-family: Delicious; src: url(\'Delicious-Roman.otf\'); } ',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 35, type: 'punctuation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 42, type: 'support.function.name.sass' },
{ startIndex: 46, type: 'string.punctuation.sass' },
{ startIndex: 47, type: 'string.sass' },
{ startIndex: 66, type: 'string.punctuation.sass' },
{ startIndex: 67, type: 'support.function.name.sass' },
{ startIndex: 68, type: 'punctuation.sass' },
{ startIndex: 69, type: '' },
{ startIndex: 70, type: 'punctuation.curly.sass' },
{ startIndex: 71, type: '' }
]}],
// Keyframes
[{
line: '@-webkit-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-moz-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-o-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'support.function.name.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'punctuation.curly.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 43, type: 'constant.numeric.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 48, type: 'punctuation.curly.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'constant.numeric.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 66, type: 'constant.numeric.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'punctuation.curly.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'constant.numeric.sass' },
{ startIndex: 83, type: 'punctuation.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 87, type: 'punctuation.curly.sass' },
{ startIndex: 88, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'support.function.name.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 125, type: 'punctuation.curly.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 129, type: 'constant.numeric.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 134, type: 'punctuation.curly.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 136, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 144, type: '' },
{ startIndex: 145, type: 'constant.numeric.sass' },
{ startIndex: 146, type: 'punctuation.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'punctuation.curly.sass' },
{ startIndex: 149, type: '' },
{ startIndex: 152, type: 'constant.numeric.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'punctuation.curly.sass' },
{ startIndex: 158, type: '' },
{ startIndex: 159, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 168, type: 'constant.numeric.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'punctuation.curly.sass' },
{ startIndex: 172, type: '' },
{ startIndex: 173, type: 'punctuation.curly.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'support.function.name.sass' },
{ startIndex: 208, type: '' },
{ startIndex: 209, type: 'punctuation.curly.sass' },
{ startIndex: 210, type: '' },
{ startIndex: 213, type: 'constant.numeric.sass' },
{ startIndex: 215, type: '' },
{ startIndex: 218, type: 'punctuation.curly.sass' },
{ startIndex: 219, type: '' },
{ startIndex: 220, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 228, type: '' },
{ startIndex: 229, type: 'constant.numeric.sass' },
{ startIndex: 230, type: 'punctuation.sass' },
{ startIndex: 231, type: '' },
{ startIndex: 232, type: 'punctuation.curly.sass' },
{ startIndex: 233, type: '' },
{ startIndex: 236, type: 'constant.numeric.sass' },
{ startIndex: 240, type: '' },
{ startIndex: 241, type: 'punctuation.curly.sass' },
{ startIndex: 242, type: '' },
{ startIndex: 243, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 251, type: '' },
{ startIndex: 252, type: 'constant.numeric.sass' },
{ startIndex: 253, type: 'punctuation.sass' },
{ startIndex: 254, type: '' },
{ startIndex: 255, type: 'punctuation.curly.sass' },
{ startIndex: 256, type: '' },
{ startIndex: 257, type: 'punctuation.curly.sass' },
{ startIndex: 258, type: '' },
{ startIndex: 259, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 269, type: '' },
{ startIndex: 270, type: 'support.function.name.sass' },
{ startIndex: 289, type: '' },
{ startIndex: 290, type: 'punctuation.curly.sass' },
{ startIndex: 291, type: '' },
{ startIndex: 294, type: 'constant.numeric.sass' },
{ startIndex: 296, type: '' },
{ startIndex: 299, type: 'punctuation.curly.sass' },
{ startIndex: 300, type: '' },
{ startIndex: 301, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 309, type: '' },
{ startIndex: 310, type: 'constant.numeric.sass' },
{ startIndex: 311, type: 'punctuation.sass' },
{ startIndex: 312, type: '' },
{ startIndex: 313, type: 'punctuation.curly.sass' },
{ startIndex: 314, type: '' },
{ startIndex: 317, type: 'constant.numeric.sass' },
{ startIndex: 321, type: '' },
{ startIndex: 322, type: 'punctuation.curly.sass' },
{ startIndex: 323, type: '' },
{ startIndex: 324, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 332, type: '' },
{ startIndex: 333, type: 'constant.numeric.sass' },
{ startIndex: 334, type: 'punctuation.sass' },
{ startIndex: 335, type: '' },
{ startIndex: 336, type: 'punctuation.curly.sass' },
{ startIndex: 337, type: '' },
{ startIndex: 338, type: 'punctuation.curly.sass' }
]}],
// String escaping
[{
line: '[data-icon=\'test-1\']:before {\n content:\'\\\\\';\n}\n/* a comment */\n$var1: \'\\\'\';\n$var2: "\\"";\n/* another comment */',
tokens: [
{ startIndex: 0, type: 'punctuation.bracket.sass' },
{ startIndex: 1, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 10, type: 'keyword.operator.sass' },
{ startIndex: 11, type: 'string.punctuation.sass' },
{ startIndex: 12, type: 'string.sass' },
{ startIndex: 18, type: 'string.punctuation.sass' },
{ startIndex: 19, type: 'punctuation.bracket.sass' },
{ startIndex: 20, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 32, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 40, type: 'string.punctuation.sass' },
{ startIndex: 41, type: 'string.sass' },
{ startIndex: 43, type: 'string.punctuation.sass' },
{ startIndex: 44, type: 'punctuation.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'punctuation.curly.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'comment.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'variable.decl.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'string.punctuation.sass' },
{ startIndex: 72, type: 'string.sass' },
{ startIndex: 74, type: 'string.punctuation.sass' },
{ startIndex: 75, type: 'punctuation.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: 'variable.decl.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'string.punctuation.sass' },
{ startIndex: 85, type: 'string.sass' },
{ startIndex: 87, type: 'string.punctuation.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 90, type: 'comment.sass' }
]}],
// IE star hacks
[{
line: 'body {',
tokens: null},
{
line: ' _content: "";',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'string.punctuation.sass' },
{ startIndex: 13, type: 'string.punctuation.sass' },
{ startIndex: 14, type: 'punctuation.sass' }
]}]
]);
});
test('identifier escaping', function() {
modesUtil.assertTokenization(tokenizationSupport, [{
line: 'input[type= \\"submit\\"',
tokens: [
{ startIndex:0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex:5, type: 'punctuation.bracket.sass'},
{ startIndex:6, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex:10, type: 'keyword.operator.sass'},
{ startIndex:11, type: ''},
{ startIndex:12, type: sassTokenTypes.TOKEN_VALUE + '.sass'}
]}
]);
});
test('identifier escaping 2', function() {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '.\\34 hello { -moz-foo: --myvar }',
tokens: [
{ startIndex:0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex:10, type: ''},
{ startIndex:11, type: 'punctuation.curly.sass'},
{ startIndex:12, type: ''},
{ startIndex:13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass'},
{ startIndex:22, type: ''},
{ startIndex:23, type: sassTokenTypes.TOKEN_VALUE + '.sass'},
{ startIndex:30, type: ''},
{ startIndex:31, type: 'punctuation.curly.sass'},
]}
]);
});
test('onEnter', function() {
assertOnEnter.indents('', '.myRule {', '');
assertOnEnter.indents('', 'background: url(', '');
assertOnEnter.indents('', '.myRule[', '');
assertOnEnter.indentsOutdents('', '.myRule {', '}');
});
});
| src/vs/languages/sass/test/common/sass.test.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017886517161969095,
0.00017521102563478053,
0.00016697966202627867,
0.00017541008128318936,
0.0000016733348502384615
] |
{
"id": 6,
"code_window": [
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n",
"\t\t\t/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */\n",
"\t\t\tbreakpoints: Breakpoint[];\n",
"\t\t};\n",
"\t}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t/** Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments. */\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 243
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol
*/
declare module DebugProtocol {
/** Base class of requests, responses, and events. */
export interface ProtocolMessage {
/** Sequence number */
seq: number;
/** One of "request", "response", or "event" */
type: string;
}
/** Client-initiated request */
export interface Request extends ProtocolMessage {
/** The command to execute */
command: string;
/** Object containing arguments for the command */
arguments?: any;
}
/** Server-initiated event */
export interface Event extends ProtocolMessage {
/** Type of event */
event: string;
/** Event-specific information */
body?: any;
}
/** Server-initiated response to client request */
export interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request */
request_seq: number;
/** Outcome of the request */
success: boolean;
/** The command requested */
command: string;
/** Contains error message if success == false. */
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
//---- Events
/** Event message for "initialized" event type.
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
A debug adapter is expected to send this event when it is ready to accept configuration requests.
The sequence of events/requests is as follows:
- adapters sends InitializedEvent (at any time)
- frontend sends zero or more SetBreakpointsRequest
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
- frontend sends other configuration requests that are added in the future
- frontend sends one ConfigurationDoneRequest
*/
export interface InitializedEvent extends Event {
}
/** Event message for "stopped" event type.
The event indicates that the execution of the debugee has stopped due to a break condition.
This can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.
*/
export interface StoppedEvent extends Event {
body: {
/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */
reason: string;
/** The thread which was stopped. */
threadId?: number;
/** Additional information. E.g. if reason is 'exception', text contains the exception name. */
text?: string;
};
}
/** Event message for "exited" event type.
The event indicates that the debugee has exited.
*/
export interface ExitedEvent extends Event {
body: {
/** The exit code returned from the debuggee. */
exitCode: number;
};
}
/** Event message for "terminated" event types.
The event indicates that debugging of the debuggee has terminated.
*/
export interface TerminatedEvent extends Event {
body?: {
/** A debug adapter may set 'restart' to true to request that the front end restarts the session. */
restart?: boolean;
}
}
/** Event message for "thread" event type.
The event indicates that a thread has started or exited.
*/
export interface ThreadEvent extends Event {
body: {
/** The reason for the event (such as: 'started', 'exited'). */
reason: string;
/** The identifier of the thread. */
threadId: number;
};
}
/** Event message for "output" event type.
The event indicates that the target has produced output.
*/
export interface OutputEvent extends Event {
body: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category?: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
}
/** Event message for "breakpoint" event type.
The event indicates that some information about a breakpoint has changed.
*/
export interface BreakpointEvent extends Event {
body: {
/** The reason for the event (such as: 'changed', 'new'). */
reason: string;
/** The breakpoint. */
breakpoint: Breakpoint;
}
}
//---- Requests
/** On error that is whenever 'success' is false, the body can provide more details.
*/
export interface ErrorResponse extends Response {
body: {
/** An optional, structured error message. */
error?: Message
}
}
/** Initialize request; value of command field is "initialize".
*/
export interface InitializeRequest extends Request {
arguments: InitializeRequestArguments;
}
/** Arguments for "initialize" request. */
export interface InitializeRequestArguments {
/** The ID of the debugger adapter. Used to select or verify debugger adapter. */
adapterID: string;
/** If true all line numbers are 1-based (default). */
linesStartAt1?: boolean;
/** If true all column numbers are 1-based (default). */
columnsStartAt1?: boolean;
/** Determines in what format paths are specified. Possible values are 'path' or 'uri'. The default is 'path', which is the native format. */
pathFormat?: string;
}
/** Response to Initialize request. */
export interface InitializeResponse extends Response {
/** The capabilities of this debug adapter */
body?: Capabilites;
}
/** ConfigurationDone request; value of command field is "configurationDone".
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
*/
export interface ConfigurationDoneRequest extends Request {
arguments?: ConfigurationDoneArguments;
}
/** Arguments for "configurationDone" request. */
export interface ConfigurationDoneArguments {
/* The configurationDone request has no standardized attributes. */
}
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
export interface ConfigurationDoneResponse extends Response {
}
/** Launch request; value of command field is "launch".
*/
export interface LaunchRequest extends Request {
arguments: LaunchRequestArguments;
}
/** Arguments for "launch" request. */
export interface LaunchRequestArguments {
/* The launch request has no standardized attributes. */
}
/** Response to "launch" request. This is just an acknowledgement, so no body field is required. */
export interface LaunchResponse extends Response {
}
/** Attach request; value of command field is "attach".
*/
export interface AttachRequest extends Request {
arguments: AttachRequestArguments;
}
/** Arguments for "attach" request. */
export interface AttachRequestArguments {
/* The attach request has no standardized attributes. */
}
/** Response to "attach" request. This is just an acknowledgement, so no body field is required. */
export interface AttachResponse extends Response {
}
/** Disconnect request; value of command field is "disconnect".
*/
export interface DisconnectRequest extends Request {
arguments?: DisconnectArguments;
}
/** Arguments for "disconnect" request. */
export interface DisconnectArguments {
}
/** Response to "disconnect" request. This is just an acknowledgement, so no body field is required. */
export interface DisconnectResponse extends Response {
}
/** SetBreakpoints request; value of command field is "setBreakpoints".
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
To clear all breakpoint for a source, specify an empty array.
When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
*/
export interface SetBreakpointsRequest extends Request {
arguments: SetBreakpointsArguments;
}
/** Arguments for "setBreakpoints" request. */
export interface SetBreakpointsArguments {
/** The source location of the breakpoints; either source.path or source.reference must be specified. */
source: Source;
/** The code locations of the breakpoints. */
breakpoints?: SourceBreakpoint[];
/** Deprecated: The code locations of the breakpoints. */
lines?: number[];
}
/** Response to "setBreakpoints" request.
Returned is information about each breakpoint created by this request.
This includes the actual code location and whether the breakpoint could be verified.
*/
export interface SetBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */
breakpoints: Breakpoint[];
};
}
/** SetFunctionBreakpoints request; value of command field is "setFunctionBreakpoints".
Sets multiple function breakpoints and clears all previous function breakpoints.
To clear all function breakpoint, specify an empty array.
When a function breakpoint is hit, a StoppedEvent (event type 'function breakpoint') is generated.
*/
export interface SetFunctionBreakpointsRequest extends Request {
arguments: SetFunctionBreakpointsArguments;
}
/** Arguments for "setFunctionBreakpoints" request. */
export interface SetFunctionBreakpointsArguments {
/** The function names of the breakpoints. */
breakpoints: FunctionBreakpoint[];
}
/** Response to "setFunctionBreakpoints" request.
Returned is information about each breakpoint created by this request.
*/
export interface SetFunctionBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
breakpoints: Breakpoint[];
};
}
/** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
*/
export interface SetExceptionBreakpointsRequest extends Request {
arguments: SetExceptionBreakpointsArguments;
}
/** Arguments for "setExceptionBreakpoints" request. */
export interface SetExceptionBreakpointsArguments {
/** Names of enabled exception breakpoints. */
filters: string[];
}
/** Response to "setExceptionBreakpoints" request. This is just an acknowledgement, so no body field is required. */
export interface SetExceptionBreakpointsResponse extends Response {
}
/** Continue request; value of command field is "continue".
The request starts the debuggee to run again.
*/
export interface ContinueRequest extends Request {
arguments: ContinueArguments;
}
/** Arguments for "continue" request. */
export interface ContinueArguments {
/** continue execution for this thread. */
threadId: number;
}
/** Response to "continue" request. This is just an acknowledgement, so no body field is required. */
export interface ContinueResponse extends Response {
}
/** Next request; value of command field is "next".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface NextRequest extends Request {
arguments: NextArguments;
}
/** Arguments for "next" request. */
export interface NextArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "next" request. This is just an acknowledgement, so no body field is required. */
export interface NextResponse extends Response {
}
/** StepIn request; value of command field is "stepIn".
The request starts the debuggee to run again for one step.
The debug adapter will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepInRequest extends Request {
arguments: StepInArguments;
}
/** Arguments for "stepIn" request. */
export interface StepInArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepIn" request. This is just an acknowledgement, so no body field is required. */
export interface StepInResponse extends Response {
}
/** StepOutIn request; value of command field is "stepOut".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepOutRequest extends Request {
arguments: StepOutArguments;
}
/** Arguments for "stepOut" request. */
export interface StepOutArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepOut" request. This is just an acknowledgement, so no body field is required. */
export interface StepOutResponse extends Response {
}
/** Pause request; value of command field is "pause".
The request suspenses the debuggee.
penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command.
*/
export interface PauseRequest extends Request {
arguments: PauseArguments;
}
/** Arguments for "pause" request. */
export interface PauseArguments {
/** Pause execution for this thread. */
threadId: number;
}
/** Response to "pause" request. This is just an acknowledgement, so no body field is required. */
export interface PauseResponse extends Response {
}
/** StackTrace request; value of command field is "stackTrace".
The request returns a stacktrace from the current execution state.
*/
export interface StackTraceRequest extends Request {
arguments: StackTraceArguments;
}
/** Arguments for "stackTrace" request. */
export interface StackTraceArguments {
/** Retrieve the stacktrace for this thread. */
threadId: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
}
/** Response to "stackTrace" request. */
export interface StackTraceResponse extends Response {
body: {
/** The frames of the stackframe. If the array has length zero, there are no stackframes available.
This means that there is no location information available. */
stackFrames: StackFrame[];
};
}
/** Scopes request; value of command field is "scopes".
The request returns the variable scopes for a given stackframe ID.
*/
export interface ScopesRequest extends Request {
arguments: ScopesArguments;
}
/** Arguments for "scopes" request. */
export interface ScopesArguments {
/** Retrieve the scopes for this stackframe. */
frameId: number;
}
/** Response to "scopes" request. */
export interface ScopesResponse extends Response {
body: {
/** The scopes of the stackframe. If the array has length zero, there are no scopes available. */
scopes: Scope[];
};
}
/** Variables request; value of command field is "variables".
Retrieves all children for the given variable reference.
*/
export interface VariablesRequest extends Request {
arguments: VariablesArguments;
}
/** Arguments for "variables" request. */
export interface VariablesArguments {
/** The Variable reference. */
variablesReference: number;
}
/** Response to "variables" request. */
export interface VariablesResponse extends Response {
body: {
/** All children for the given variable reference */
variables: Variable[];
};
}
/** Source request; value of command field is "source".
The request retrieves the source code for a given source reference.
*/
export interface SourceRequest extends Request {
arguments: SourceArguments;
}
/** Arguments for "source" request. */
export interface SourceArguments {
/** The reference to the source. This is the value received in Source.reference. */
sourceReference: number;
}
/** Response to "source" request. */
export interface SourceResponse extends Response {
body: {
/** Content of the source reference */
content: string;
};
}
/** Thread request; value of command field is "threads".
The request retrieves a list of all threads.
*/
export interface ThreadsRequest extends Request {
}
/** Response to "threads" request. */
export interface ThreadsResponse extends Response {
body: {
/** All threads. */
threads: Thread[];
};
}
/** Evaluate request; value of command field is "evaluate".
Evaluates the given expression in the context of the top most stack frame.
The expression has access to any variables and arguments that are in scope.
*/
export interface EvaluateRequest extends Request {
arguments: EvaluateArguments;
}
/** Arguments for "evaluate" request. */
export interface EvaluateArguments {
/** The expression to evaluate. */
expression: string;
/** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
}
/** Response to "evaluate" request. */
export interface EvaluateResponse extends Response {
body: {
/** The result of the evaluate. */
result: string;
/** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest */
variablesReference: number;
};
}
//---- Types
/** Information about the capabilities of a debug adapter. */
export interface Capabilites {
/** The debug adapter supports the configurationDoneRequest. */
supportsConfigurationDoneRequest?: boolean;
/** The debug adapter supports functionBreakpoints. */
supportsFunctionBreakpoints?: boolean;
/** The debug adapter supports conditionalBreakpoints. */
supportsConditionalBreakpoints?: boolean;
/** The debug adapter supports a (side effect free) evaluate request for data hovers. */
supportsEvaluateForHovers?: boolean;
/** Available filters for the setExceptionBreakpoints request. */
exceptionBreakpointFilters?: [
{
filter: string,
label: string
}
]
}
/** A structured message object. Used to return errors from requests. */
export interface Message {
/** Unique identifier for the message. */
id: number;
/** A format string for the message. Embedded variables have the form '{name}'.
If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. */
format: string;
/** An object used as a dictionary for looking up the variables in the format string. */
variables?: { [key: string]: string };
/** if true send to telemetry */
sendTelemetry?: boolean;
/** if true show user */
showUser?: boolean;
}
/** A Thread */
export interface Thread {
/** Unique identifier for the thread. */
id: number;
/** A name of the thread. */
name: string;
}
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
/** The long (absolute) path of the source. It is not guaranteed that the source exists at this location. */
path?: string;
/** If sourceReference > 0 the contents of the source can be retrieved through the SourceRequest. A sourceReference is only valid for a session, so it must not be used to persist a source. */
sourceReference?: number;
/** The (optional) origin of this source: possible values "internal module", "inlined content from source map", etc. */
origin?: string;
/** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */
adapterData?: any;
}
/** A Stackframe contains the source location. */
export interface StackFrame {
/** An identifier for the stack frame. This id can be used to retrieve the scopes of the frame with the 'scopesRequest'. */
id: number;
/** The name of the stack frame, typically a method name */
name: string;
/** The optional source of the frame. */
source?: Source;
/** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */
line: number;
/** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */
column: number;
}
/** A Scope is a named container for variables. */
export interface Scope {
/** name of the scope (as such 'Arguments', 'Locals') */
name: string;
/** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */
variablesReference: number;
/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
/** A Variable is a name/value pair.
If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest.
*/
export interface Variable {
/** The variable's name */
name: string;
/** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
value: string;
/** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
variablesReference: number;
}
/** Properties of a breakpoint passed to the setBreakpoints request.
*/
export interface SourceBreakpoint {
/** The source line of the breakpoint. */
line: number;
/** An optional source column of the breakpoint. */
column?: number;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Properties of a breakpoint passed to the setFunctionBreakpoints request.
*/
export interface FunctionBreakpoint {
/** The name of the function. */
name: string;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.
*/
export interface Breakpoint {
/** An optional unique identifier for the breakpoint. */
id?: number;
/** If true breakpoint could be set (but not necessarily at the desired location). */
verified: boolean;
/** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */
message?: string;
/** The source where the breakpoint is located. */
source?: Source;
/** The actual line of the breakpoint. */
line?: number;
/** The actual column of the breakpoint. */
column?: number;
}
}
| src/vs/workbench/parts/debug/common/debugProtocol.d.ts | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.9786279797554016,
0.02587128058075905,
0.00016323589079547673,
0.0001892208238132298,
0.12888191640377045
] |
{
"id": 6,
"code_window": [
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n",
"\t\t\t/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */\n",
"\t\t\tbreakpoints: Breakpoint[];\n",
"\t\t};\n",
"\t}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t/** Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments. */\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 243
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/languages/sass/common/sass.contribution';
import SASS = require('vs/languages/sass/common/sass');
import modesUtil = require('vs/editor/test/common/modesUtil');
import Modes = require('vs/editor/common/modes');
import * as sassTokenTypes from 'vs/languages/sass/common/sassTokenTypes';
suite('Sass Colorizer', () => {
var tokenizationSupport: Modes.ITokenizationSupport;
var assertOnEnter: modesUtil.IOnEnterAsserter;
setup((done) => {
modesUtil.load('sass').then(mode => {
tokenizationSupport = mode.tokenizationSupport;
assertOnEnter = modesUtil.createOnEnterAsserter(mode.getId(), mode.richEditSupport);
done();
});
});
test('', () => {
modesUtil.executeTests(tokenizationSupport, [
// Nested Rules
[{
line: '#main {\n width: 97%;\n p, div {\n font-size: 2em;\n a { font-weight: bold; }\n }\n pre { font-size: 3em; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'punctuation.curly.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 10, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'constant.numeric.sass' },
{ startIndex: 20, type: 'punctuation.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 24, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'punctuation.curly.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 37, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'constant.numeric.sass' },
{ startIndex: 51, type: 'punctuation.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'punctuation.curly.sass' },
{ startIndex: 60, type: '' },
{ startIndex: 61, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 78, type: 'punctuation.sass' },
{ startIndex: 79, type: '' },
{ startIndex: 80, type: 'punctuation.curly.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 92, type: 'punctuation.curly.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'constant.numeric.sass' },
{ startIndex: 108, type: 'punctuation.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' }
]}],
// Parent selector
[{
line: '#main {\n color: black;\n a {\n font-weight: bold;\n &:hover { color: red; }\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'punctuation.curly.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 10, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 22, type: 'punctuation.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 26, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 34, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 51, type: 'punctuation.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR_TAG + '.sass' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.curly.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 77, type: 'punctuation.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'punctuation.curly.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' }
]}],
// Nested Properties
[{
line: '.funky {\n font: 2px/3px {\n family: fantasy;\n size: 30em;\n weight: bold;\n }\n color: black;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'constant.numeric.sass' },
{ startIndex: 20, type: 'keyword.operator.sass' },
{ startIndex: 21, type: 'constant.numeric.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 46, type: 'punctuation.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 52, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 58, type: 'constant.numeric.sass' },
{ startIndex: 62, type: 'punctuation.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 68, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 75, type: '' },
{ startIndex: 76, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 80, type: 'punctuation.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 95, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 100, type: 'punctuation.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'punctuation.curly.sass' }
]}],
// Nesting name conflicts
[{
line: 'tr.default {\n foo: { // properties\n foo : 1;\n }\n foo: 1px; // rule\n foo.bar { // selector\n foo : 1;\n }\n foo:bar { // selector\n foo : 1;\n }\n foo: 1px; // rule\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 15, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'punctuation.curly.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'comment.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'constant.numeric.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'constant.numeric.sass' },
{ startIndex: 63, type: 'punctuation.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'comment.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'comment.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 101, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'constant.numeric.sass' },
{ startIndex: 108, type: 'punctuation.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' },
{ startIndex: 113, type: '' },
{ startIndex: 116, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 123, type: '' },
{ startIndex: 124, type: 'punctuation.curly.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 126, type: 'comment.sass' },
{ startIndex: 137, type: '' },
{ startIndex: 142, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'constant.numeric.sass' },
{ startIndex: 149, type: 'punctuation.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: 'punctuation.curly.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 161, type: '' },
{ startIndex: 162, type: 'constant.numeric.sass' },
{ startIndex: 165, type: 'punctuation.sass' },
{ startIndex: 166, type: '' },
{ startIndex: 167, type: 'comment.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: 'punctuation.curly.sass' }
]}],
// Missing semicolons
[{
line: 'tr.default {\n foo.bar {\n $foo: 1px\n }\n foo: {\n foo : white\n }\n foo.bar1 {\n @extend tr.default\n }\n foo.bar2 {\n @import "compass"\n }\n bar: black\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 15, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'punctuation.curly.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 29, type: 'variable.decl.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'constant.numeric.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 45, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'punctuation.curly.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 56, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 67, type: '' },
{ startIndex: 70, type: 'punctuation.curly.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 74, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'punctuation.curly.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 97, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 114, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 122, type: '' },
{ startIndex: 123, type: 'punctuation.curly.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 129, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 136, type: '' },
{ startIndex: 137, type: 'string.punctuation.sass' },
{ startIndex: 138, type: 'string.sass' },
{ startIndex: 145, type: 'string.punctuation.sass' },
{ startIndex: 146, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 157, type: '' },
{ startIndex: 158, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 163, type: '' },
{ startIndex: 164, type: 'punctuation.curly.sass' }
]}],
// Rules without whitespaces
[{
line: 'legend {foo{a:s}margin-top:0;margin-bottom:#123;margin-top:s(1)}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 14, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 15, type: 'punctuation.curly.sass' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 27, type: 'constant.numeric.sass' },
{ startIndex: 28, type: 'punctuation.sass' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 43, type: 'constant.rgb-value.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 59, type: 'support.function.name.sass' },
{ startIndex: 61, type: 'constant.numeric.sass' },
{ startIndex: 62, type: 'support.function.name.sass' },
{ startIndex: 63, type: 'punctuation.curly.sass' }
]}],
// Extended comments
[{
line: '/* extended comment syntax */\n/* This comment is\n * several lines long.\n * since it uses the CSS comment syntax,\n * it will appear in the CSS output. */\nbody { color: black; }\n\n// These comments are only one line long each.\n// They won\'t appear in the CSS output,\n// since they use the single-line comment syntax.\na { color: green; }',
tokens: [
{ startIndex: 0, type: 'comment.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'comment.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'comment.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'comment.sass' },
{ startIndex: 112, type: '' },
{ startIndex: 113, type: 'comment.sass' },
{ startIndex: 152, type: '' },
{ startIndex: 153, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 157, type: '' },
{ startIndex: 158, type: 'punctuation.curly.sass' },
{ startIndex: 159, type: '' },
{ startIndex: 160, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 166, type: '' },
{ startIndex: 167, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 172, type: 'punctuation.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'punctuation.curly.sass' },
{ startIndex: 175, type: '' },
{ startIndex: 177, type: 'comment.sass' },
{ startIndex: 223, type: '' },
{ startIndex: 224, type: 'comment.sass' },
{ startIndex: 263, type: '' },
{ startIndex: 264, type: 'comment.sass' },
{ startIndex: 313, type: '' },
{ startIndex: 314, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 315, type: '' },
{ startIndex: 316, type: 'punctuation.curly.sass' },
{ startIndex: 317, type: '' },
{ startIndex: 318, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 324, type: '' },
{ startIndex: 325, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 330, type: 'punctuation.sass' },
{ startIndex: 331, type: '' },
{ startIndex: 332, type: 'punctuation.curly.sass' }
]}],
// Variable declarations and references
[{
line: '$width: 5em;\n$width: "Second width?" !default;\n#main {\n $localvar: 6em;\n width: $width;\n\n $font-size: 12px;\n $line-height: 30px;\n font: #{$font-size}/#{$line-height};\n}\n$name: foo;\n$attr: border;\np.#{$name} {\n #{$attr}-color: blue;\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'constant.numeric.sass' },
{ startIndex: 11, type: 'punctuation.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'variable.decl.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'string.punctuation.sass' },
{ startIndex: 22, type: 'string.sass' },
{ startIndex: 35, type: 'string.punctuation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'literal.sass' },
{ startIndex: 45, type: 'punctuation.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 53, type: 'punctuation.curly.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 57, type: 'variable.decl.sass' },
{ startIndex: 67, type: '' },
{ startIndex: 68, type: 'constant.numeric.sass' },
{ startIndex: 71, type: 'punctuation.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'variable.ref.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 93, type: 'variable.decl.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'constant.numeric.sass' },
{ startIndex: 109, type: 'punctuation.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 113, type: 'variable.decl.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'constant.numeric.sass' },
{ startIndex: 131, type: 'punctuation.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 135, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 140, type: '' },
{ startIndex: 141, type: 'support.function.interpolation.sass' },
{ startIndex: 143, type: 'variable.ref.sass' },
{ startIndex: 153, type: 'support.function.interpolation.sass' },
{ startIndex: 154, type: 'keyword.operator.sass' },
{ startIndex: 155, type: 'support.function.interpolation.sass' },
{ startIndex: 157, type: 'variable.ref.sass' },
{ startIndex: 169, type: 'support.function.interpolation.sass' },
{ startIndex: 170, type: 'punctuation.sass' },
{ startIndex: 171, type: '' },
{ startIndex: 172, type: 'punctuation.curly.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'variable.decl.sass' },
{ startIndex: 180, type: '' },
{ startIndex: 181, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 184, type: 'punctuation.sass' },
{ startIndex: 185, type: '' },
{ startIndex: 186, type: 'variable.decl.sass' },
{ startIndex: 192, type: '' },
{ startIndex: 193, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 199, type: 'punctuation.sass' },
{ startIndex: 200, type: '' },
{ startIndex: 201, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 203, type: 'support.function.interpolation.sass' },
{ startIndex: 205, type: 'variable.ref.sass' },
{ startIndex: 210, type: 'support.function.interpolation.sass' },
{ startIndex: 211, type: '' },
{ startIndex: 212, type: 'punctuation.curly.sass' },
{ startIndex: 213, type: '' },
{ startIndex: 216, type: 'support.function.interpolation.sass' },
{ startIndex: 218, type: 'variable.ref.sass' },
{ startIndex: 223, type: 'support.function.interpolation.sass' },
{ startIndex: 224, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 231, type: '' },
{ startIndex: 232, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 236, type: 'punctuation.sass' },
{ startIndex: 237, type: '' },
{ startIndex: 238, type: 'punctuation.curly.sass' }
]}],
// Variable declaration with whitespaces
[{
line: '// Set the color of your columns\n$grid-background-column-color : rgba(100, 100, 225, 0.25) !default;',
tokens: [
{ startIndex: 0, type: 'comment.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 33, type: 'variable.decl.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'support.function.name.sass' },
{ startIndex: 74, type: 'constant.numeric.sass' },
{ startIndex: 77, type: 'punctuation.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'constant.numeric.sass' },
{ startIndex: 82, type: 'punctuation.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'constant.numeric.sass' },
{ startIndex: 87, type: 'punctuation.sass' },
{ startIndex: 88, type: '' },
{ startIndex: 89, type: 'constant.numeric.sass' },
{ startIndex: 93, type: 'support.function.name.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 97, type: 'literal.sass' },
{ startIndex: 105, type: 'punctuation.sass' }
]}],
// Operations
[{
line: 'p {\n width: (1em + 2em) * 3;\n color: #010203 + #040506;\n font-family: sans- + "serif";\n margin: 3px + 4px auto;\n content: "I ate #{5 + 10} pies!";\n color: hsl(0, 100%, 50%);\n color: hsl($hue: 0, $saturation: 100%, $lightness: 50%);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'punctuation.curly.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 6, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'punctuation.parenthesis.sass' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'keyword.operator.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'constant.numeric.sass' },
{ startIndex: 23, type: 'punctuation.parenthesis.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'keyword.operator.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'constant.numeric.sass' },
{ startIndex: 28, type: 'punctuation.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 32, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'constant.rgb-value.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'keyword.operator.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'constant.rgb-value.sass' },
{ startIndex: 56, type: 'punctuation.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 60, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'keyword.operator.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 81, type: 'string.punctuation.sass' },
{ startIndex: 82, type: 'string.sass' },
{ startIndex: 87, type: 'string.punctuation.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 92, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 100, type: 'constant.numeric.sass' },
{ startIndex: 103, type: '' },
{ startIndex: 104, type: 'keyword.operator.sass' },
{ startIndex: 105, type: '' },
{ startIndex: 106, type: 'constant.numeric.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 114, type: 'punctuation.sass' },
{ startIndex: 115, type: '' },
{ startIndex: 118, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'string.punctuation.sass' },
{ startIndex: 128, type: 'string.sass' },
{ startIndex: 149, type: 'string.punctuation.sass' },
{ startIndex: 150, type: 'punctuation.sass' },
{ startIndex: 151, type: '' },
{ startIndex: 154, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 161, type: 'support.function.name.sass' },
{ startIndex: 165, type: 'constant.numeric.sass' },
{ startIndex: 166, type: 'punctuation.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 168, type: 'constant.numeric.sass' },
{ startIndex: 172, type: 'punctuation.sass' },
{ startIndex: 173, type: '' },
{ startIndex: 174, type: 'constant.numeric.sass' },
{ startIndex: 177, type: 'support.function.name.sass' },
{ startIndex: 178, type: 'punctuation.sass' },
{ startIndex: 179, type: '' },
{ startIndex: 182, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'support.function.name.sass' },
{ startIndex: 193, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'constant.numeric.sass' },
{ startIndex: 200, type: 'punctuation.sass' },
{ startIndex: 201, type: '' },
{ startIndex: 202, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 214, type: '' },
{ startIndex: 215, type: 'constant.numeric.sass' },
{ startIndex: 219, type: 'punctuation.sass' },
{ startIndex: 220, type: '' },
{ startIndex: 221, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 232, type: '' },
{ startIndex: 233, type: 'constant.numeric.sass' },
{ startIndex: 236, type: 'support.function.name.sass' },
{ startIndex: 237, type: 'punctuation.sass' },
{ startIndex: 238, type: '' },
{ startIndex: 239, type: 'punctuation.curly.sass' }
]}],
// Function
[{
line: '$grid-width: 40px;\n$gutter-width: 10px;\n@function grid-width($n) {\n @return $n * $grid-width + ($n - 1) * $gutter-width;\n}\n#sidebar { width: grid-width(5); }',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'constant.numeric.sass' },
{ startIndex: 17, type: 'punctuation.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'variable.decl.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'constant.numeric.sass' },
{ startIndex: 38, type: 'punctuation.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'support.function.name.sass' },
{ startIndex: 61, type: 'variable.ref.sass' },
{ startIndex: 63, type: 'support.function.name.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.curly.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 69, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: 'variable.ref.sass' },
{ startIndex: 79, type: '' },
{ startIndex: 80, type: 'keyword.operator.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'variable.ref.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: 'keyword.operator.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'punctuation.parenthesis.sass' },
{ startIndex: 97, type: 'variable.ref.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 100, type: 'keyword.operator.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'constant.numeric.sass' },
{ startIndex: 103, type: 'punctuation.parenthesis.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'keyword.operator.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'variable.ref.sass' },
{ startIndex: 120, type: 'punctuation.sass' },
{ startIndex: 121, type: '' },
{ startIndex: 122, type: 'punctuation.curly.sass' },
{ startIndex: 123, type: '' },
{ startIndex: 124, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 133, type: 'punctuation.curly.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 135, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'support.function.name.sass' },
{ startIndex: 153, type: 'constant.numeric.sass' },
{ startIndex: 154, type: 'support.function.name.sass' },
{ startIndex: 155, type: 'punctuation.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'punctuation.curly.sass' }
]}],
// Imports
[{
line: '@import "foo.scss";\n$family: unquote("Droid+Sans");\n@import "rounded-corners" url("http://fonts.googleapis.com/css?family=#{$family}");\n#main {\n @import "example";\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'string.punctuation.sass' },
{ startIndex: 9, type: 'string.sass' },
{ startIndex: 17, type: 'string.punctuation.sass' },
{ startIndex: 18, type: 'punctuation.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'variable.decl.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'support.function.name.sass' },
{ startIndex: 37, type: 'string.punctuation.sass' },
{ startIndex: 38, type: 'string.sass' },
{ startIndex: 48, type: 'string.punctuation.sass' },
{ startIndex: 49, type: 'support.function.name.sass' },
{ startIndex: 50, type: 'punctuation.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'string.punctuation.sass' },
{ startIndex: 61, type: 'string.sass' },
{ startIndex: 76, type: 'string.punctuation.sass' },
{ startIndex: 77, type: '' },
{ startIndex: 78, type: 'support.function.name.sass' },
{ startIndex: 82, type: 'string.punctuation.sass' },
{ startIndex: 83, type: 'string.sass' },
{ startIndex: 132, type: 'string.punctuation.sass' },
{ startIndex: 133, type: 'support.function.name.sass' },
{ startIndex: 134, type: 'punctuation.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 136, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'punctuation.curly.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 146, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 153, type: '' },
{ startIndex: 154, type: 'string.punctuation.sass' },
{ startIndex: 155, type: 'string.sass' },
{ startIndex: 162, type: 'string.punctuation.sass' },
{ startIndex: 163, type: 'punctuation.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'punctuation.curly.sass' }
]}],
// Media
[{
line: '.sidebar {\n width: 300px;\n @media screen and (orientation: landscape) {\n width: 500px;\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'punctuation.curly.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'constant.numeric.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'keyword.operator.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'punctuation.parenthesis.sass' },
{ startIndex: 48, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 61, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 70, type: 'punctuation.parenthesis.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'constant.numeric.sass' },
{ startIndex: 90, type: 'punctuation.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 94, type: 'punctuation.curly.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'punctuation.curly.sass' }
]}],
// Extend
[{
line: '.error {\n border: 1px #f00;\n background-color: #fdd;\n}\n.seriousError {\n @extend .error;\n border-width: 3px;\n}\n#context a%extreme {\n color: blue;\n font-weight: bold;\n font-size: 2em;\n}\n.notice {\n @extend %extreme !optional;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'punctuation.curly.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'constant.rgb-value.sass' },
{ startIndex: 27, type: 'punctuation.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'constant.rgb-value.sass' },
{ startIndex: 53, type: 'punctuation.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 57, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'punctuation.curly.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 75, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 89, type: 'punctuation.sass' },
{ startIndex: 90, type: '' },
{ startIndex: 93, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: 'constant.numeric.sass' },
{ startIndex: 110, type: 'punctuation.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'punctuation.curly.sass' },
{ startIndex: 113, type: '' },
{ startIndex: 114, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 122, type: '' },
{ startIndex: 123, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 132, type: '' },
{ startIndex: 133, type: 'punctuation.curly.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 137, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 144, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 148, type: 'punctuation.sass' },
{ startIndex: 149, type: '' },
{ startIndex: 152, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 173, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 183, type: '' },
{ startIndex: 184, type: 'constant.numeric.sass' },
{ startIndex: 187, type: 'punctuation.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'punctuation.curly.sass' },
{ startIndex: 190, type: '' },
{ startIndex: 191, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'punctuation.curly.sass' },
{ startIndex: 200, type: '' },
{ startIndex: 203, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 210, type: '' },
{ startIndex: 211, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 219, type: '' },
{ startIndex: 220, type: 'literal.sass' },
{ startIndex: 229, type: 'punctuation.sass' },
{ startIndex: 230, type: '' },
{ startIndex: 231, type: 'punctuation.curly.sass' }
]}],
// @debug and @warn
[{
line: '@debug 10em + 12em;\n@mixin adjust-location($x, $y) {\n @if unitless($x) {\n @warn "Assuming #{$x} to be in pixels";\n $x: 1px * $x;\n }\n @if unitless($y) {\n @warn "Assuming #{$y} to be in pixels";\n $y: 1px * $y;\n }\n position: relative; left: $x; top: $y;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'constant.numeric.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'keyword.operator.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 18, type: 'punctuation.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'support.function.name.sass' },
{ startIndex: 43, type: 'variable.ref.sass' },
{ startIndex: 45, type: 'punctuation.sass' },
{ startIndex: 46, type: '' },
{ startIndex: 47, type: 'variable.ref.sass' },
{ startIndex: 49, type: 'support.function.name.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'support.function.name.sass' },
{ startIndex: 68, type: 'variable.ref.sass' },
{ startIndex: 70, type: 'support.function.name.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'string.punctuation.sass' },
{ startIndex: 85, type: 'string.sass' },
{ startIndex: 115, type: 'string.punctuation.sass' },
{ startIndex: 116, type: 'punctuation.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 122, type: 'variable.decl.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 126, type: 'constant.numeric.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'keyword.operator.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 132, type: 'variable.ref.sass' },
{ startIndex: 134, type: 'punctuation.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 138, type: 'punctuation.curly.sass' },
{ startIndex: 139, type: '' },
{ startIndex: 142, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 145, type: '' },
{ startIndex: 146, type: 'support.function.name.sass' },
{ startIndex: 155, type: 'variable.ref.sass' },
{ startIndex: 157, type: 'support.function.name.sass' },
{ startIndex: 158, type: '' },
{ startIndex: 159, type: 'punctuation.curly.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 165, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'string.punctuation.sass' },
{ startIndex: 172, type: 'string.sass' },
{ startIndex: 202, type: 'string.punctuation.sass' },
{ startIndex: 203, type: 'punctuation.sass' },
{ startIndex: 204, type: '' },
{ startIndex: 209, type: 'variable.decl.sass' },
{ startIndex: 212, type: '' },
{ startIndex: 213, type: 'constant.numeric.sass' },
{ startIndex: 216, type: '' },
{ startIndex: 217, type: 'keyword.operator.sass' },
{ startIndex: 218, type: '' },
{ startIndex: 219, type: 'variable.ref.sass' },
{ startIndex: 221, type: 'punctuation.sass' },
{ startIndex: 222, type: '' },
{ startIndex: 225, type: 'punctuation.curly.sass' },
{ startIndex: 226, type: '' },
{ startIndex: 229, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 238, type: '' },
{ startIndex: 239, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 247, type: 'punctuation.sass' },
{ startIndex: 248, type: '' },
{ startIndex: 249, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 254, type: '' },
{ startIndex: 255, type: 'variable.ref.sass' },
{ startIndex: 257, type: 'punctuation.sass' },
{ startIndex: 258, type: '' },
{ startIndex: 259, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 263, type: '' },
{ startIndex: 264, type: 'variable.ref.sass' },
{ startIndex: 266, type: 'punctuation.sass' },
{ startIndex: 267, type: '' },
{ startIndex: 268, type: 'punctuation.curly.sass' }
]}],
// if statement
[{
line: 'p {\n @if 1 + 1 == 2 { border: 1px solid; }\n @if 5 < 3 { border: 2px dotted; }\n @if null { border: 3px double; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'punctuation.curly.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 6, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'constant.numeric.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'keyword.operator.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'constant.numeric.sass' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'keyword.operator.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'punctuation.curly.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'constant.numeric.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 40, type: 'punctuation.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 43, type: 'punctuation.curly.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 47, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'constant.numeric.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 53, type: 'keyword.operator.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'constant.numeric.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'constant.numeric.sass' },
{ startIndex: 75, type: '' },
{ startIndex: 76, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 82, type: 'punctuation.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: '' },
{ startIndex: 88, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 92, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 103, type: 'punctuation.curly.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 112, type: '' },
{ startIndex: 113, type: 'constant.numeric.sass' },
{ startIndex: 116, type: '' },
{ startIndex: 117, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 123, type: 'punctuation.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 125, type: 'punctuation.curly.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'punctuation.curly.sass' }
]}],
// if-else statement
[{
line: '$type: monster;\np {\n @if $type == ocean {\n color: blue;\n } @else if $type == matador {\n color: red;\n } @else {\n color: black;\n }\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 14, type: 'punctuation.sass' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'punctuation.curly.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 22, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'variable.ref.sass' },
{ startIndex: 31, type: '' },
{ startIndex: 32, type: 'keyword.operator.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 58, type: 'punctuation.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 69, type: '' },
{ startIndex: 70, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: 'variable.ref.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: 'keyword.operator.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 90, type: 'punctuation.curly.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 102, type: '' },
{ startIndex: 103, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 106, type: 'punctuation.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 110, type: 'punctuation.curly.sass' },
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 118, type: 'punctuation.curly.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 124, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 131, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 136, type: 'punctuation.sass' },
{ startIndex: 137, type: '' },
{ startIndex: 140, type: 'punctuation.curly.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'punctuation.curly.sass' }
]}],
// for statement
[{
line: '@for $i from 1 through 3 {\n .item-#{$i} { width: 2em * $i; }\n}',
tokens: [
{ startIndex: 0, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'variable.ref.sass' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'constant.numeric.sass' },
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'constant.numeric.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 35, type: 'support.function.interpolation.sass' },
{ startIndex: 37, type: 'variable.ref.sass' },
{ startIndex: 39, type: 'support.function.interpolation.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 41, type: 'punctuation.curly.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'constant.numeric.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: 'keyword.operator.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'variable.ref.sass' },
{ startIndex: 58, type: 'punctuation.sass' },
{ startIndex: 59, type: '' },
{ startIndex: 60, type: 'punctuation.curly.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' }
]}],
// each statement
[{
line: '@each $animal in puma, sea-slug, egret, salamander {\n .#{$animal}-icon {\n background-image: url(\'/images/#{$animal}.png\');\n }\n}',
tokens: [
{ startIndex: 0, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'variable.ref.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 21, type: 'keyword.operator.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 31, type: 'keyword.operator.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 33, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 38, type: 'keyword.operator.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'punctuation.curly.sass' },
{ startIndex: 52, type: '' },
{ startIndex: 55, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 56, type: 'support.function.interpolation.sass' },
{ startIndex: 58, type: 'variable.ref.sass' },
{ startIndex: 65, type: 'support.function.interpolation.sass' },
{ startIndex: 66, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' },
{ startIndex: 73, type: '' },
{ startIndex: 78, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'support.function.name.sass' },
{ startIndex: 100, type: 'string.punctuation.sass' },
{ startIndex: 101, type: 'string.sass' },
{ startIndex: 123, type: 'string.punctuation.sass' },
{ startIndex: 124, type: 'support.function.name.sass' },
{ startIndex: 125, type: 'punctuation.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 129, type: 'punctuation.curly.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 131, type: 'punctuation.curly.sass' }
]}],
// while statement
[{
line: '$i: 6;\n@while $i > 0 {\n .item-#{$i} { width: 2em * $i; }\n $i: $i - 2;\n}',
tokens: [
{ startIndex: 0, type: 'variable.decl.sass' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'constant.numeric.sass' },
{ startIndex: 5, type: 'punctuation.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'keyword.operator.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'constant.numeric.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'punctuation.curly.sass' },
{ startIndex: 22, type: '' },
{ startIndex: 25, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 31, type: 'support.function.interpolation.sass' },
{ startIndex: 33, type: 'variable.ref.sass' },
{ startIndex: 35, type: 'support.function.interpolation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'punctuation.curly.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'constant.numeric.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'keyword.operator.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'variable.ref.sass' },
{ startIndex: 54, type: 'punctuation.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'punctuation.curly.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 60, type: 'variable.decl.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'variable.ref.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: 'keyword.operator.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'constant.numeric.sass' },
{ startIndex: 70, type: 'punctuation.sass' },
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'punctuation.curly.sass' }
]}],
// Function with control statements nested
[{
line: '@function foo($total, $a) {\n @for $i from 0 to $total {\n @if (unit($a) == "%") and ($i == ($total - 1)) {\n $z: 100%;\n @return \'1\';\n }\n }\n @return $grid;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'support.function.name.sass' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 20, type: 'punctuation.sass' },
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'variable.ref.sass' },
{ startIndex: 24, type: 'support.function.name.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'punctuation.curly.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 30, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'variable.ref.sass' },
{ startIndex: 37, type: '' },
{ startIndex: 38, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'constant.numeric.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 45, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'variable.ref.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' },
{ startIndex: 56, type: '' },
{ startIndex: 61, type: 'keyword.flow.control.at-rule.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'punctuation.parenthesis.sass' },
{ startIndex: 66, type: 'support.function.name.sass' },
{ startIndex: 71, type: 'variable.ref.sass' },
{ startIndex: 73, type: 'support.function.name.sass' },
{ startIndex: 74, type: '' },
{ startIndex: 75, type: 'keyword.operator.sass' },
{ startIndex: 77, type: '' },
{ startIndex: 78, type: 'string.punctuation.sass' },
{ startIndex: 79, type: 'string.sass' },
{ startIndex: 80, type: 'string.punctuation.sass' },
{ startIndex: 81, type: 'punctuation.parenthesis.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 83, type: 'keyword.operator.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 87, type: 'punctuation.parenthesis.sass' },
{ startIndex: 88, type: 'variable.ref.sass' },
{ startIndex: 90, type: '' },
{ startIndex: 91, type: 'keyword.operator.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: 'punctuation.parenthesis.sass' },
{ startIndex: 95, type: 'variable.ref.sass' },
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'keyword.operator.sass' },
{ startIndex: 103, type: '' },
{ startIndex: 104, type: 'constant.numeric.sass' },
{ startIndex: 105, type: 'punctuation.parenthesis.sass' },
{ startIndex: 106, type: 'punctuation.parenthesis.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 108, type: 'punctuation.curly.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 116, type: 'variable.decl.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 120, type: 'constant.numeric.sass' },
{ startIndex: 124, type: 'punctuation.sass' },
{ startIndex: 125, type: '' },
{ startIndex: 132, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 139, type: '' },
{ startIndex: 140, type: 'string.punctuation.sass' },
{ startIndex: 141, type: 'string.sass' },
{ startIndex: 142, type: 'string.punctuation.sass' },
{ startIndex: 143, type: 'punctuation.sass' },
{ startIndex: 144, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' },
{ startIndex: 150, type: '' },
{ startIndex: 153, type: 'punctuation.curly.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'variable.ref.sass' },
{ startIndex: 170, type: 'punctuation.sass' },
{ startIndex: 171, type: '' },
{ startIndex: 172, type: 'punctuation.curly.sass' }
]}],
// @mixin simple
[{
line: '@mixin large-text {\n font: {\n family: Arial;\n size: 20px;\n weight: bold;\n }\n color: #ff0000;\n}\n.page-title {\n @include large-text;\n padding: 4px;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'punctuation.curly.sass' },
{ startIndex: 19, type: '' },
{ startIndex: 22, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 34, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 42, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 47, type: 'punctuation.sass' },
{ startIndex: 48, type: '' },
{ startIndex: 53, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'constant.numeric.sass' },
{ startIndex: 63, type: 'punctuation.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 69, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 81, type: 'punctuation.sass' },
{ startIndex: 82, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'constant.rgb-value.sass' },
{ startIndex: 103, type: 'punctuation.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'punctuation.curly.sass' },
{ startIndex: 106, type: '' },
{ startIndex: 107, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 123, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 132, type: 'support.function.name.sass' },
{ startIndex: 142, type: 'punctuation.sass' },
{ startIndex: 143, type: '' },
{ startIndex: 146, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 154, type: '' },
{ startIndex: 155, type: 'constant.numeric.sass' },
{ startIndex: 158, type: 'punctuation.sass' },
{ startIndex: 159, type: '' },
{ startIndex: 160, type: 'punctuation.curly.sass' }
]}],
// @mixin with parameters
[{
line: '@mixin sexy-border($color, $width: 1in) {\n border: {\n color: $color;\n width: $width;\n style: dashed;\n }\n}\np { @include sexy-border(blue); }',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 19, type: 'variable.ref.sass' },
{ startIndex: 25, type: 'punctuation.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'constant.numeric.sass' },
{ startIndex: 38, type: 'support.function.name.sass' },
{ startIndex: 39, type: '' },
{ startIndex: 40, type: 'punctuation.curly.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 44, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'punctuation.curly.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 64, type: '' },
{ startIndex: 65, type: 'variable.ref.sass' },
{ startIndex: 71, type: 'punctuation.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 77, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'variable.ref.sass' },
{ startIndex: 90, type: 'punctuation.sass' },
{ startIndex: 91, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 102, type: '' },
{ startIndex: 103, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 109, type: 'punctuation.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 113, type: 'punctuation.curly.sass' },
{ startIndex: 114, type: '' },
{ startIndex: 115, type: 'punctuation.curly.sass' },
{ startIndex: 116, type: '' },
{ startIndex: 117, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 121, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'support.function.name.sass' },
{ startIndex: 142, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 146, type: 'support.function.name.sass' },
{ startIndex: 147, type: 'punctuation.sass' },
{ startIndex: 148, type: '' },
{ startIndex: 149, type: 'punctuation.curly.sass' }
]}],
// @mixin with varargs
[{
line: '@mixin box-shadow($shadows...) {\n -moz-box-shadow: $shadows;\n -webkit-box-shadow: $shadows;\n box-shadow: $shadows;\n}\n.shadows {\n @include box-shadow(0px 4px 5px #666, 2px 6px 10px #999);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 18, type: 'variable.ref.sass' },
{ startIndex: 26, type: 'keyword.operator.sass' },
{ startIndex: 29, type: 'support.function.name.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'punctuation.curly.sass' },
{ startIndex: 32, type: '' },
{ startIndex: 35, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 51, type: '' },
{ startIndex: 52, type: 'variable.ref.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'variable.ref.sass' },
{ startIndex: 92, type: 'punctuation.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 107, type: '' },
{ startIndex: 108, type: 'variable.ref.sass' },
{ startIndex: 116, type: 'punctuation.sass' },
{ startIndex: 117, type: '' },
{ startIndex: 118, type: 'punctuation.curly.sass' },
{ startIndex: 119, type: '' },
{ startIndex: 120, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 128, type: '' },
{ startIndex: 129, type: 'punctuation.curly.sass' },
{ startIndex: 130, type: '' },
{ startIndex: 133, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'support.function.name.sass' },
{ startIndex: 153, type: 'constant.numeric.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'constant.numeric.sass' },
{ startIndex: 160, type: '' },
{ startIndex: 161, type: 'constant.numeric.sass' },
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'constant.rgb-value.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'constant.numeric.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: 'constant.numeric.sass' },
{ startIndex: 178, type: '' },
{ startIndex: 179, type: 'constant.numeric.sass' },
{ startIndex: 183, type: '' },
{ startIndex: 184, type: 'constant.rgb-value.sass' },
{ startIndex: 188, type: 'support.function.name.sass' },
{ startIndex: 189, type: 'punctuation.sass' },
{ startIndex: 190, type: '' },
{ startIndex: 191, type: 'punctuation.curly.sass' }
]}],
// @include with varargs
[{
line: '@mixin colors($text, $background, $border) {\n color: $text;\n background-color: $background;\n border-color: $border;\n}\n$values: #ff0000, #00ff00, #0000ff;\n.primary {\n @include colors($values...);\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 14, type: 'variable.ref.sass' },
{ startIndex: 19, type: 'punctuation.sass' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'variable.ref.sass' },
{ startIndex: 32, type: 'punctuation.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'variable.ref.sass' },
{ startIndex: 41, type: 'support.function.name.sass' },
{ startIndex: 42, type: '' },
{ startIndex: 43, type: 'punctuation.curly.sass' },
{ startIndex: 44, type: '' },
{ startIndex: 47, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: 'variable.ref.sass' },
{ startIndex: 59, type: 'punctuation.sass' },
{ startIndex: 60, type: '' },
{ startIndex: 63, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 80, type: '' },
{ startIndex: 81, type: 'variable.ref.sass' },
{ startIndex: 92, type: 'punctuation.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 96, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 109, type: '' },
{ startIndex: 110, type: 'variable.ref.sass' },
{ startIndex: 117, type: 'punctuation.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'punctuation.curly.sass' },
{ startIndex: 120, type: '' },
{ startIndex: 121, type: 'variable.decl.sass' },
{ startIndex: 129, type: '' },
{ startIndex: 130, type: 'constant.rgb-value.sass' },
{ startIndex: 137, type: 'keyword.operator.sass' },
{ startIndex: 138, type: '' },
{ startIndex: 139, type: 'constant.rgb-value.sass' },
{ startIndex: 146, type: 'keyword.operator.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'constant.rgb-value.sass' },
{ startIndex: 155, type: 'punctuation.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 165, type: '' },
{ startIndex: 166, type: 'punctuation.curly.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 170, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 178, type: '' },
{ startIndex: 179, type: 'support.function.name.sass' },
{ startIndex: 186, type: 'variable.ref.sass' },
{ startIndex: 193, type: 'keyword.operator.sass' },
{ startIndex: 196, type: 'support.function.name.sass' },
{ startIndex: 197, type: 'punctuation.sass' },
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'punctuation.curly.sass' }
]}],
// @include with body
[{
line: '@mixin apply-to-ie6-only {\n * html {\n @content;\n }\n}\n@include apply-to-ie6-only {\n #logo {\n background-image: url(/logo.gif);\n }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'punctuation.curly.sass' },
{ startIndex: 26, type: '' },
{ startIndex: 29, type: sassTokenTypes.TOKEN_SELECTOR_TAG + '.sass' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: 'punctuation.curly.sass' },
{ startIndex: 37, type: '' },
{ startIndex: 42, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 50, type: '' },
{ startIndex: 54, type: 'punctuation.curly.sass' },
{ startIndex: 55, type: '' },
{ startIndex: 56, type: 'punctuation.curly.sass' },
{ startIndex: 57, type: '' },
{ startIndex: 58, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: 'support.function.name.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 94, type: '' },
{ startIndex: 95, type: 'punctuation.curly.sass' },
{ startIndex: 96, type: '' },
{ startIndex: 101, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 118, type: '' },
{ startIndex: 119, type: 'support.function.name.sass' },
{ startIndex: 123, type: 'string.sass' },
{ startIndex: 132, type: 'support.function.name.sass' },
{ startIndex: 133, type: 'punctuation.sass' },
{ startIndex: 134, type: '' },
{ startIndex: 137, type: 'punctuation.curly.sass' },
{ startIndex: 138, type: '' },
{ startIndex: 139, type: 'punctuation.curly.sass' }
]}],
// CSS charset
[{
line: '@charset "UTF-8";',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'string.punctuation.sass' },
{ startIndex: 10, type: 'string.sass' },
{ startIndex: 15, type: 'string.punctuation.sass' },
{ startIndex: 16, type: 'punctuation.sass' }
]}],
// CSS attributes
[{
line: '[rel="external"]::after {\n content: \'s\';\n}',
tokens: [
{ startIndex: 0, type: 'punctuation.bracket.sass' },
{ startIndex: 1, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 4, type: 'keyword.operator.sass' },
{ startIndex: 5, type: 'string.punctuation.sass' },
{ startIndex: 6, type: 'string.sass' },
{ startIndex: 14, type: 'string.punctuation.sass' },
{ startIndex: 15, type: 'punctuation.bracket.sass' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'punctuation.curly.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 30, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'string.punctuation.sass' },
{ startIndex: 40, type: 'string.sass' },
{ startIndex: 41, type: 'string.punctuation.sass' },
{ startIndex: 42, type: 'punctuation.sass' },
{ startIndex: 43, type: '' },
{ startIndex: 44, type: 'punctuation.curly.sass' }
]}],
// CSS @page
[{
line: '@page :left {\n margin-left: 4cm;\n margin-right: 3cm;\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'punctuation.curly.sass' },
{ startIndex: 13, type: '' },
{ startIndex: 16, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'constant.numeric.sass' },
{ startIndex: 32, type: 'punctuation.sass' },
{ startIndex: 33, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: 'constant.numeric.sass' },
{ startIndex: 53, type: 'punctuation.sass' },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'punctuation.curly.sass' }
]}],
// Extend with interpolation variable
[{
line: '@mixin error($a: false) {\n @extend .#{$a};\n @extend ##{$a};\n}\n#bar {a: 1px;}\n.bar {b: 1px;}\nfoo {\n @include error(\'bar\'); \n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'support.function.name.sass' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 22, type: 'support.function.name.sass' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'punctuation.curly.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 28, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 35, type: '' },
{ startIndex: 36, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 37, type: 'support.function.interpolation.sass' },
{ startIndex: 39, type: 'variable.ref.sass' },
{ startIndex: 41, type: 'support.function.interpolation.sass' },
{ startIndex: 42, type: 'punctuation.sass' },
{ startIndex: 43, type: '' },
{ startIndex: 46, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 53, type: '' },
{ startIndex: 54, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 55, type: 'support.function.interpolation.sass' },
{ startIndex: 57, type: 'variable.ref.sass' },
{ startIndex: 59, type: 'support.function.interpolation.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 68, type: '' },
{ startIndex: 69, type: 'punctuation.curly.sass' },
{ startIndex: 70, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: 'constant.numeric.sass' },
{ startIndex: 76, type: 'punctuation.sass' },
{ startIndex: 77, type: 'punctuation.curly.sass' },
{ startIndex: 78, type: '' },
{ startIndex: 79, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'punctuation.curly.sass' },
{ startIndex: 85, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 87, type: '' },
{ startIndex: 88, type: 'constant.numeric.sass' },
{ startIndex: 91, type: 'punctuation.sass' },
{ startIndex: 92, type: 'punctuation.curly.sass' },
{ startIndex: 93, type: '' },
{ startIndex: 94, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 97, type: '' },
{ startIndex: 98, type: 'punctuation.curly.sass' },
{ startIndex: 99, type: '' },
{ startIndex: 102, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 110, type: '' },
{ startIndex: 111, type: 'support.function.name.sass' },
{ startIndex: 117, type: 'string.punctuation.sass' },
{ startIndex: 118, type: 'string.sass' },
{ startIndex: 121, type: 'string.punctuation.sass' },
{ startIndex: 122, type: 'support.function.name.sass' },
{ startIndex: 123, type: 'punctuation.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 128, type: 'punctuation.curly.sass' }
]}],
// @font-face
[{
line: '@font-face { font-family: Delicious; src: url(\'Delicious-Roman.otf\'); } ',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'punctuation.curly.sass' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 35, type: 'punctuation.sass' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 41, type: '' },
{ startIndex: 42, type: 'support.function.name.sass' },
{ startIndex: 46, type: 'string.punctuation.sass' },
{ startIndex: 47, type: 'string.sass' },
{ startIndex: 66, type: 'string.punctuation.sass' },
{ startIndex: 67, type: 'support.function.name.sass' },
{ startIndex: 68, type: 'punctuation.sass' },
{ startIndex: 69, type: '' },
{ startIndex: 70, type: 'punctuation.curly.sass' },
{ startIndex: 71, type: '' }
]}],
// Keyframes
[{
line: '@-webkit-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-moz-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-o-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}',
tokens: [
{ startIndex: 0, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'support.function.name.sass' },
{ startIndex: 38, type: '' },
{ startIndex: 39, type: 'punctuation.curly.sass' },
{ startIndex: 40, type: '' },
{ startIndex: 43, type: 'constant.numeric.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 48, type: 'punctuation.curly.sass' },
{ startIndex: 49, type: '' },
{ startIndex: 50, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 58, type: '' },
{ startIndex: 59, type: 'constant.numeric.sass' },
{ startIndex: 60, type: 'punctuation.sass' },
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'punctuation.curly.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 66, type: 'constant.numeric.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'punctuation.curly.sass' },
{ startIndex: 72, type: '' },
{ startIndex: 73, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 81, type: '' },
{ startIndex: 82, type: 'constant.numeric.sass' },
{ startIndex: 83, type: 'punctuation.sass' },
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'punctuation.curly.sass' },
{ startIndex: 86, type: '' },
{ startIndex: 87, type: 'punctuation.curly.sass' },
{ startIndex: 88, type: '' },
{ startIndex: 89, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 104, type: '' },
{ startIndex: 105, type: 'support.function.name.sass' },
{ startIndex: 124, type: '' },
{ startIndex: 125, type: 'punctuation.curly.sass' },
{ startIndex: 126, type: '' },
{ startIndex: 129, type: 'constant.numeric.sass' },
{ startIndex: 131, type: '' },
{ startIndex: 134, type: 'punctuation.curly.sass' },
{ startIndex: 135, type: '' },
{ startIndex: 136, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 144, type: '' },
{ startIndex: 145, type: 'constant.numeric.sass' },
{ startIndex: 146, type: 'punctuation.sass' },
{ startIndex: 147, type: '' },
{ startIndex: 148, type: 'punctuation.curly.sass' },
{ startIndex: 149, type: '' },
{ startIndex: 152, type: 'constant.numeric.sass' },
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'punctuation.curly.sass' },
{ startIndex: 158, type: '' },
{ startIndex: 159, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 167, type: '' },
{ startIndex: 168, type: 'constant.numeric.sass' },
{ startIndex: 169, type: 'punctuation.sass' },
{ startIndex: 170, type: '' },
{ startIndex: 171, type: 'punctuation.curly.sass' },
{ startIndex: 172, type: '' },
{ startIndex: 173, type: 'punctuation.curly.sass' },
{ startIndex: 174, type: '' },
{ startIndex: 175, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 188, type: '' },
{ startIndex: 189, type: 'support.function.name.sass' },
{ startIndex: 208, type: '' },
{ startIndex: 209, type: 'punctuation.curly.sass' },
{ startIndex: 210, type: '' },
{ startIndex: 213, type: 'constant.numeric.sass' },
{ startIndex: 215, type: '' },
{ startIndex: 218, type: 'punctuation.curly.sass' },
{ startIndex: 219, type: '' },
{ startIndex: 220, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 228, type: '' },
{ startIndex: 229, type: 'constant.numeric.sass' },
{ startIndex: 230, type: 'punctuation.sass' },
{ startIndex: 231, type: '' },
{ startIndex: 232, type: 'punctuation.curly.sass' },
{ startIndex: 233, type: '' },
{ startIndex: 236, type: 'constant.numeric.sass' },
{ startIndex: 240, type: '' },
{ startIndex: 241, type: 'punctuation.curly.sass' },
{ startIndex: 242, type: '' },
{ startIndex: 243, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 251, type: '' },
{ startIndex: 252, type: 'constant.numeric.sass' },
{ startIndex: 253, type: 'punctuation.sass' },
{ startIndex: 254, type: '' },
{ startIndex: 255, type: 'punctuation.curly.sass' },
{ startIndex: 256, type: '' },
{ startIndex: 257, type: 'punctuation.curly.sass' },
{ startIndex: 258, type: '' },
{ startIndex: 259, type: sassTokenTypes.TOKEN_AT_KEYWORD + '.sass' },
{ startIndex: 269, type: '' },
{ startIndex: 270, type: 'support.function.name.sass' },
{ startIndex: 289, type: '' },
{ startIndex: 290, type: 'punctuation.curly.sass' },
{ startIndex: 291, type: '' },
{ startIndex: 294, type: 'constant.numeric.sass' },
{ startIndex: 296, type: '' },
{ startIndex: 299, type: 'punctuation.curly.sass' },
{ startIndex: 300, type: '' },
{ startIndex: 301, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 309, type: '' },
{ startIndex: 310, type: 'constant.numeric.sass' },
{ startIndex: 311, type: 'punctuation.sass' },
{ startIndex: 312, type: '' },
{ startIndex: 313, type: 'punctuation.curly.sass' },
{ startIndex: 314, type: '' },
{ startIndex: 317, type: 'constant.numeric.sass' },
{ startIndex: 321, type: '' },
{ startIndex: 322, type: 'punctuation.curly.sass' },
{ startIndex: 323, type: '' },
{ startIndex: 324, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 332, type: '' },
{ startIndex: 333, type: 'constant.numeric.sass' },
{ startIndex: 334, type: 'punctuation.sass' },
{ startIndex: 335, type: '' },
{ startIndex: 336, type: 'punctuation.curly.sass' },
{ startIndex: 337, type: '' },
{ startIndex: 338, type: 'punctuation.curly.sass' }
]}],
// String escaping
[{
line: '[data-icon=\'test-1\']:before {\n content:\'\\\\\';\n}\n/* a comment */\n$var1: \'\\\'\';\n$var2: "\\"";\n/* another comment */',
tokens: [
{ startIndex: 0, type: 'punctuation.bracket.sass' },
{ startIndex: 1, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex: 10, type: 'keyword.operator.sass' },
{ startIndex: 11, type: 'string.punctuation.sass' },
{ startIndex: 12, type: 'string.sass' },
{ startIndex: 18, type: 'string.punctuation.sass' },
{ startIndex: 19, type: 'punctuation.bracket.sass' },
{ startIndex: 20, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'punctuation.curly.sass' },
{ startIndex: 29, type: '' },
{ startIndex: 32, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 40, type: 'string.punctuation.sass' },
{ startIndex: 41, type: 'string.sass' },
{ startIndex: 43, type: 'string.punctuation.sass' },
{ startIndex: 44, type: 'punctuation.sass' },
{ startIndex: 45, type: '' },
{ startIndex: 46, type: 'punctuation.curly.sass' },
{ startIndex: 47, type: '' },
{ startIndex: 48, type: 'comment.sass' },
{ startIndex: 63, type: '' },
{ startIndex: 64, type: 'variable.decl.sass' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'string.punctuation.sass' },
{ startIndex: 72, type: 'string.sass' },
{ startIndex: 74, type: 'string.punctuation.sass' },
{ startIndex: 75, type: 'punctuation.sass' },
{ startIndex: 76, type: '' },
{ startIndex: 77, type: 'variable.decl.sass' },
{ startIndex: 83, type: '' },
{ startIndex: 84, type: 'string.punctuation.sass' },
{ startIndex: 85, type: 'string.sass' },
{ startIndex: 87, type: 'string.punctuation.sass' },
{ startIndex: 88, type: 'punctuation.sass' },
{ startIndex: 89, type: '' },
{ startIndex: 90, type: 'comment.sass' }
]}],
// IE star hacks
[{
line: 'body {',
tokens: null},
{
line: ' _content: "";',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: sassTokenTypes.TOKEN_PROPERTY + '.sass' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'string.punctuation.sass' },
{ startIndex: 13, type: 'string.punctuation.sass' },
{ startIndex: 14, type: 'punctuation.sass' }
]}]
]);
});
test('identifier escaping', function() {
modesUtil.assertTokenization(tokenizationSupport, [{
line: 'input[type= \\"submit\\"',
tokens: [
{ startIndex:0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex:5, type: 'punctuation.bracket.sass'},
{ startIndex:6, type: sassTokenTypes.TOKEN_VALUE + '.sass' },
{ startIndex:10, type: 'keyword.operator.sass'},
{ startIndex:11, type: ''},
{ startIndex:12, type: sassTokenTypes.TOKEN_VALUE + '.sass'}
]}
]);
});
test('identifier escaping 2', function() {
modesUtil.assertTokenization(tokenizationSupport, [{
line: '.\\34 hello { -moz-foo: --myvar }',
tokens: [
{ startIndex:0, type: sassTokenTypes.TOKEN_SELECTOR + '.sass' },
{ startIndex:10, type: ''},
{ startIndex:11, type: 'punctuation.curly.sass'},
{ startIndex:12, type: ''},
{ startIndex:13, type: sassTokenTypes.TOKEN_PROPERTY + '.sass'},
{ startIndex:22, type: ''},
{ startIndex:23, type: sassTokenTypes.TOKEN_VALUE + '.sass'},
{ startIndex:30, type: ''},
{ startIndex:31, type: 'punctuation.curly.sass'},
]}
]);
});
test('onEnter', function() {
assertOnEnter.indents('', '.myRule {', '');
assertOnEnter.indents('', 'background: url(', '');
assertOnEnter.indents('', '.myRule[', '');
assertOnEnter.indentsOutdents('', '.myRule {', '}');
});
});
| src/vs/languages/sass/test/common/sass.test.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00018038935377262533,
0.0001766073692124337,
0.00016678137762937695,
0.00017680582823231816,
0.0000019634362615761347
] |
{
"id": 6,
"code_window": [
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n",
"\t\t\t/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */\n",
"\t\t\tbreakpoints: Breakpoint[];\n",
"\t\t};\n",
"\t}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t/** Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments. */\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 243
} | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><polygon fill="#2d2d30" points="13.64,7.396 12.169,2.898 10.706,3.761 11.087,2 6.557,2 6.936,3.762 5.473,2.898 4,7.396 5.682,7.554 4.513,8.561 5.013,9 2,9 2,14 7,14 7,10.747 7.978,11.606 8.82,9.725 9.661,11.602 13.144,8.562 11.968,7.554"/><g fill="#C5C5C5"><path d="M12.301 6.518l-2.772.262 2.086 1.788-1.594 1.392-1.201-2.682-1.201 2.682-1.583-1.392 2.075-1.788-2.771-.262.696-2.126 2.358 1.392-.599-2.784h2.053l-.602 2.783 2.359-1.392.696 2.127z"/><rect x="3" y="10" width="3" height="3"/></g></svg> | src/vs/base/browser/ui/findinput/regex-dark.svg | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017051813483703882,
0.00017051813483703882,
0.00017051813483703882,
0.00017051813483703882,
0
] |
{
"id": 6,
"code_window": [
"\t*/\n",
"\texport interface SetBreakpointsResponse extends Response {\n",
"\t\tbody: {\n",
"\t\t\t/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */\n",
"\t\t\tbreakpoints: Breakpoint[];\n",
"\t\t};\n",
"\t}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\t/** Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments. */\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "replace",
"edit_start_line_idx": 243
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* ---------- File label ---------- */
.monaco-file-label .file-name {
color: inherit;
}
.monaco-file-label .file-path {
opacity: 0.7;
margin-left: 0.5em;
font-size: 0.9em;
} | src/vs/base/browser/ui/filelabel/filelabel.css | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0001776399149093777,
0.00017565989401191473,
0.000173679887666367,
0.00017565989401191473,
0.00000198001362150535
] |
{
"id": 7,
"code_window": [
"\t\t/** if true send to telemetry */\n",
"\t\tsendTelemetry?: boolean;\n",
"\t\t/** if true show user */\n",
"\t\tshowUser?: boolean;\n",
"\t}\n",
"\n",
"\t/** A Thread */\n",
"\texport interface Thread {\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t/** An optional url where additional information about this message can be found. */\n",
"\t\turl?: string;\n",
"\t\t/** An optional label that is presented to the user as the UI for opening the url. */\n",
"\t\turlLabel?: string;\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"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.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol
*/
declare module DebugProtocol {
/** Base class of requests, responses, and events. */
export interface ProtocolMessage {
/** Sequence number */
seq: number;
/** One of "request", "response", or "event" */
type: string;
}
/** Client-initiated request */
export interface Request extends ProtocolMessage {
/** The command to execute */
command: string;
/** Object containing arguments for the command */
arguments?: any;
}
/** Server-initiated event */
export interface Event extends ProtocolMessage {
/** Type of event */
event: string;
/** Event-specific information */
body?: any;
}
/** Server-initiated response to client request */
export interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request */
request_seq: number;
/** Outcome of the request */
success: boolean;
/** The command requested */
command: string;
/** Contains error message if success == false. */
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
//---- Events
/** Event message for "initialized" event type.
This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest).
A debug adapter is expected to send this event when it is ready to accept configuration requests.
The sequence of events/requests is as follows:
- adapters sends InitializedEvent (at any time)
- frontend sends zero or more SetBreakpointsRequest
- frontend sends one SetExceptionBreakpointsRequest (in the future 'zero or one')
- frontend sends other configuration requests that are added in the future
- frontend sends one ConfigurationDoneRequest
*/
export interface InitializedEvent extends Event {
}
/** Event message for "stopped" event type.
The event indicates that the execution of the debugee has stopped due to a break condition.
This can be caused by by a break point previously set, a stepping action has completed or by executing a debugger statement.
*/
export interface StoppedEvent extends Event {
body: {
/** The reason for the event (such as: 'step', 'breakpoint', 'exception', 'pause') */
reason: string;
/** The thread which was stopped. */
threadId?: number;
/** Additional information. E.g. if reason is 'exception', text contains the exception name. */
text?: string;
};
}
/** Event message for "exited" event type.
The event indicates that the debugee has exited.
*/
export interface ExitedEvent extends Event {
body: {
/** The exit code returned from the debuggee. */
exitCode: number;
};
}
/** Event message for "terminated" event types.
The event indicates that debugging of the debuggee has terminated.
*/
export interface TerminatedEvent extends Event {
body?: {
/** A debug adapter may set 'restart' to true to request that the front end restarts the session. */
restart?: boolean;
}
}
/** Event message for "thread" event type.
The event indicates that a thread has started or exited.
*/
export interface ThreadEvent extends Event {
body: {
/** The reason for the event (such as: 'started', 'exited'). */
reason: string;
/** The identifier of the thread. */
threadId: number;
};
}
/** Event message for "output" event type.
The event indicates that the target has produced output.
*/
export interface OutputEvent extends Event {
body: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category?: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
}
/** Event message for "breakpoint" event type.
The event indicates that some information about a breakpoint has changed.
*/
export interface BreakpointEvent extends Event {
body: {
/** The reason for the event (such as: 'changed', 'new'). */
reason: string;
/** The breakpoint. */
breakpoint: Breakpoint;
}
}
//---- Requests
/** On error that is whenever 'success' is false, the body can provide more details.
*/
export interface ErrorResponse extends Response {
body: {
/** An optional, structured error message. */
error?: Message
}
}
/** Initialize request; value of command field is "initialize".
*/
export interface InitializeRequest extends Request {
arguments: InitializeRequestArguments;
}
/** Arguments for "initialize" request. */
export interface InitializeRequestArguments {
/** The ID of the debugger adapter. Used to select or verify debugger adapter. */
adapterID: string;
/** If true all line numbers are 1-based (default). */
linesStartAt1?: boolean;
/** If true all column numbers are 1-based (default). */
columnsStartAt1?: boolean;
/** Determines in what format paths are specified. Possible values are 'path' or 'uri'. The default is 'path', which is the native format. */
pathFormat?: string;
}
/** Response to Initialize request. */
export interface InitializeResponse extends Response {
/** The capabilities of this debug adapter */
body?: Capabilites;
}
/** ConfigurationDone request; value of command field is "configurationDone".
The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent)
*/
export interface ConfigurationDoneRequest extends Request {
arguments?: ConfigurationDoneArguments;
}
/** Arguments for "configurationDone" request. */
export interface ConfigurationDoneArguments {
/* The configurationDone request has no standardized attributes. */
}
/** Response to "configurationDone" request. This is just an acknowledgement, so no body field is required. */
export interface ConfigurationDoneResponse extends Response {
}
/** Launch request; value of command field is "launch".
*/
export interface LaunchRequest extends Request {
arguments: LaunchRequestArguments;
}
/** Arguments for "launch" request. */
export interface LaunchRequestArguments {
/* The launch request has no standardized attributes. */
}
/** Response to "launch" request. This is just an acknowledgement, so no body field is required. */
export interface LaunchResponse extends Response {
}
/** Attach request; value of command field is "attach".
*/
export interface AttachRequest extends Request {
arguments: AttachRequestArguments;
}
/** Arguments for "attach" request. */
export interface AttachRequestArguments {
/* The attach request has no standardized attributes. */
}
/** Response to "attach" request. This is just an acknowledgement, so no body field is required. */
export interface AttachResponse extends Response {
}
/** Disconnect request; value of command field is "disconnect".
*/
export interface DisconnectRequest extends Request {
arguments?: DisconnectArguments;
}
/** Arguments for "disconnect" request. */
export interface DisconnectArguments {
}
/** Response to "disconnect" request. This is just an acknowledgement, so no body field is required. */
export interface DisconnectResponse extends Response {
}
/** SetBreakpoints request; value of command field is "setBreakpoints".
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
To clear all breakpoint for a source, specify an empty array.
When a breakpoint is hit, a StoppedEvent (event type 'breakpoint') is generated.
*/
export interface SetBreakpointsRequest extends Request {
arguments: SetBreakpointsArguments;
}
/** Arguments for "setBreakpoints" request. */
export interface SetBreakpointsArguments {
/** The source location of the breakpoints; either source.path or source.reference must be specified. */
source: Source;
/** The code locations of the breakpoints. */
breakpoints?: SourceBreakpoint[];
/** Deprecated: The code locations of the breakpoints. */
lines?: number[];
}
/** Response to "setBreakpoints" request.
Returned is information about each breakpoint created by this request.
This includes the actual code location and whether the breakpoint could be verified.
*/
export interface SetBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' (or the deprecated 'lines) array. */
breakpoints: Breakpoint[];
};
}
/** SetFunctionBreakpoints request; value of command field is "setFunctionBreakpoints".
Sets multiple function breakpoints and clears all previous function breakpoints.
To clear all function breakpoint, specify an empty array.
When a function breakpoint is hit, a StoppedEvent (event type 'function breakpoint') is generated.
*/
export interface SetFunctionBreakpointsRequest extends Request {
arguments: SetFunctionBreakpointsArguments;
}
/** Arguments for "setFunctionBreakpoints" request. */
export interface SetFunctionBreakpointsArguments {
/** The function names of the breakpoints. */
breakpoints: FunctionBreakpoint[];
}
/** Response to "setFunctionBreakpoints" request.
Returned is information about each breakpoint created by this request.
*/
export interface SetFunctionBreakpointsResponse extends Response {
body: {
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
breakpoints: Breakpoint[];
};
}
/** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
*/
export interface SetExceptionBreakpointsRequest extends Request {
arguments: SetExceptionBreakpointsArguments;
}
/** Arguments for "setExceptionBreakpoints" request. */
export interface SetExceptionBreakpointsArguments {
/** Names of enabled exception breakpoints. */
filters: string[];
}
/** Response to "setExceptionBreakpoints" request. This is just an acknowledgement, so no body field is required. */
export interface SetExceptionBreakpointsResponse extends Response {
}
/** Continue request; value of command field is "continue".
The request starts the debuggee to run again.
*/
export interface ContinueRequest extends Request {
arguments: ContinueArguments;
}
/** Arguments for "continue" request. */
export interface ContinueArguments {
/** continue execution for this thread. */
threadId: number;
}
/** Response to "continue" request. This is just an acknowledgement, so no body field is required. */
export interface ContinueResponse extends Response {
}
/** Next request; value of command field is "next".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface NextRequest extends Request {
arguments: NextArguments;
}
/** Arguments for "next" request. */
export interface NextArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "next" request. This is just an acknowledgement, so no body field is required. */
export interface NextResponse extends Response {
}
/** StepIn request; value of command field is "stepIn".
The request starts the debuggee to run again for one step.
The debug adapter will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepInRequest extends Request {
arguments: StepInArguments;
}
/** Arguments for "stepIn" request. */
export interface StepInArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepIn" request. This is just an acknowledgement, so no body field is required. */
export interface StepInResponse extends Response {
}
/** StepOutIn request; value of command field is "stepOut".
The request starts the debuggee to run again for one step.
penDebug will respond with a StoppedEvent (event type 'step') after running the step.
*/
export interface StepOutRequest extends Request {
arguments: StepOutArguments;
}
/** Arguments for "stepOut" request. */
export interface StepOutArguments {
/** Continue execution for this thread. */
threadId: number;
}
/** Response to "stepOut" request. This is just an acknowledgement, so no body field is required. */
export interface StepOutResponse extends Response {
}
/** Pause request; value of command field is "pause".
The request suspenses the debuggee.
penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command.
*/
export interface PauseRequest extends Request {
arguments: PauseArguments;
}
/** Arguments for "pause" request. */
export interface PauseArguments {
/** Pause execution for this thread. */
threadId: number;
}
/** Response to "pause" request. This is just an acknowledgement, so no body field is required. */
export interface PauseResponse extends Response {
}
/** StackTrace request; value of command field is "stackTrace".
The request returns a stacktrace from the current execution state.
*/
export interface StackTraceRequest extends Request {
arguments: StackTraceArguments;
}
/** Arguments for "stackTrace" request. */
export interface StackTraceArguments {
/** Retrieve the stacktrace for this thread. */
threadId: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
}
/** Response to "stackTrace" request. */
export interface StackTraceResponse extends Response {
body: {
/** The frames of the stackframe. If the array has length zero, there are no stackframes available.
This means that there is no location information available. */
stackFrames: StackFrame[];
};
}
/** Scopes request; value of command field is "scopes".
The request returns the variable scopes for a given stackframe ID.
*/
export interface ScopesRequest extends Request {
arguments: ScopesArguments;
}
/** Arguments for "scopes" request. */
export interface ScopesArguments {
/** Retrieve the scopes for this stackframe. */
frameId: number;
}
/** Response to "scopes" request. */
export interface ScopesResponse extends Response {
body: {
/** The scopes of the stackframe. If the array has length zero, there are no scopes available. */
scopes: Scope[];
};
}
/** Variables request; value of command field is "variables".
Retrieves all children for the given variable reference.
*/
export interface VariablesRequest extends Request {
arguments: VariablesArguments;
}
/** Arguments for "variables" request. */
export interface VariablesArguments {
/** The Variable reference. */
variablesReference: number;
}
/** Response to "variables" request. */
export interface VariablesResponse extends Response {
body: {
/** All children for the given variable reference */
variables: Variable[];
};
}
/** Source request; value of command field is "source".
The request retrieves the source code for a given source reference.
*/
export interface SourceRequest extends Request {
arguments: SourceArguments;
}
/** Arguments for "source" request. */
export interface SourceArguments {
/** The reference to the source. This is the value received in Source.reference. */
sourceReference: number;
}
/** Response to "source" request. */
export interface SourceResponse extends Response {
body: {
/** Content of the source reference */
content: string;
};
}
/** Thread request; value of command field is "threads".
The request retrieves a list of all threads.
*/
export interface ThreadsRequest extends Request {
}
/** Response to "threads" request. */
export interface ThreadsResponse extends Response {
body: {
/** All threads. */
threads: Thread[];
};
}
/** Evaluate request; value of command field is "evaluate".
Evaluates the given expression in the context of the top most stack frame.
The expression has access to any variables and arguments that are in scope.
*/
export interface EvaluateRequest extends Request {
arguments: EvaluateArguments;
}
/** Arguments for "evaluate" request. */
export interface EvaluateArguments {
/** The expression to evaluate. */
expression: string;
/** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
}
/** Response to "evaluate" request. */
export interface EvaluateResponse extends Response {
body: {
/** The result of the evaluate. */
result: string;
/** If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest */
variablesReference: number;
};
}
//---- Types
/** Information about the capabilities of a debug adapter. */
export interface Capabilites {
/** The debug adapter supports the configurationDoneRequest. */
supportsConfigurationDoneRequest?: boolean;
/** The debug adapter supports functionBreakpoints. */
supportsFunctionBreakpoints?: boolean;
/** The debug adapter supports conditionalBreakpoints. */
supportsConditionalBreakpoints?: boolean;
/** The debug adapter supports a (side effect free) evaluate request for data hovers. */
supportsEvaluateForHovers?: boolean;
/** Available filters for the setExceptionBreakpoints request. */
exceptionBreakpointFilters?: [
{
filter: string,
label: string
}
]
}
/** A structured message object. Used to return errors from requests. */
export interface Message {
/** Unique identifier for the message. */
id: number;
/** A format string for the message. Embedded variables have the form '{name}'.
If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. */
format: string;
/** An object used as a dictionary for looking up the variables in the format string. */
variables?: { [key: string]: string };
/** if true send to telemetry */
sendTelemetry?: boolean;
/** if true show user */
showUser?: boolean;
}
/** A Thread */
export interface Thread {
/** Unique identifier for the thread. */
id: number;
/** A name of the thread. */
name: string;
}
/** A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. */
export interface Source {
/** The short name of the source. Every source returned from the debug adapter has a name. When specifying a source to the debug adapter this name is optional. */
name?: string;
/** The long (absolute) path of the source. It is not guaranteed that the source exists at this location. */
path?: string;
/** If sourceReference > 0 the contents of the source can be retrieved through the SourceRequest. A sourceReference is only valid for a session, so it must not be used to persist a source. */
sourceReference?: number;
/** The (optional) origin of this source: possible values "internal module", "inlined content from source map", etc. */
origin?: string;
/** Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. */
adapterData?: any;
}
/** A Stackframe contains the source location. */
export interface StackFrame {
/** An identifier for the stack frame. This id can be used to retrieve the scopes of the frame with the 'scopesRequest'. */
id: number;
/** The name of the stack frame, typically a method name */
name: string;
/** The optional source of the frame. */
source?: Source;
/** The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. */
line: number;
/** The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. */
column: number;
}
/** A Scope is a named container for variables. */
export interface Scope {
/** name of the scope (as such 'Arguments', 'Locals') */
name: string;
/** The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. */
variablesReference: number;
/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
/** A Variable is a name/value pair.
If the value is structured (has children), a handle is provided to retrieve the children with the VariablesRequest.
*/
export interface Variable {
/** The variable's name */
name: string;
/** The variable's value. For structured objects this can be a multi line text, e.g. for a function the body of a function. */
value: string;
/** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
variablesReference: number;
}
/** Properties of a breakpoint passed to the setBreakpoints request.
*/
export interface SourceBreakpoint {
/** The source line of the breakpoint. */
line: number;
/** An optional source column of the breakpoint. */
column?: number;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Properties of a breakpoint passed to the setFunctionBreakpoints request.
*/
export interface FunctionBreakpoint {
/** The name of the function. */
name: string;
/** An optional expression for conditional breakpoints. */
condition?: string;
}
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.
*/
export interface Breakpoint {
/** An optional unique identifier for the breakpoint. */
id?: number;
/** If true breakpoint could be set (but not necessarily at the desired location). */
verified: boolean;
/** An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. */
message?: string;
/** The source where the breakpoint is located. */
source?: Source;
/** The actual line of the breakpoint. */
line?: number;
/** The actual column of the breakpoint. */
column?: number;
}
}
| src/vs/workbench/parts/debug/common/debugProtocol.d.ts | 1 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.9985052347183228,
0.08689351379871368,
0.00016593874897807837,
0.00018335224012844265,
0.26827743649482727
] |
{
"id": 7,
"code_window": [
"\t\t/** if true send to telemetry */\n",
"\t\tsendTelemetry?: boolean;\n",
"\t\t/** if true show user */\n",
"\t\tshowUser?: boolean;\n",
"\t}\n",
"\n",
"\t/** A Thread */\n",
"\texport interface Thread {\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t/** An optional url where additional information about this message can be found. */\n",
"\t\turl?: string;\n",
"\t\t/** An optional label that is presented to the user as the UI for opening the url. */\n",
"\t\turlLabel?: string;\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"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.
*--------------------------------------------------------------------------------------------*/
'use strict';
import ts = require('vs/languages/typescript/common/lib/typescriptServices');
export function fromValue(value: string): ts.IScriptSnapshot {
var len = value.length;
if (len > 1500000) {
// everything except newline characters will be replaced
// with whitespace. this ensures a small syntax tree and
// no symbol information overkill. keeping the newline
// characters makes further processing (based on line and
// column) easy for us
value = value.replace(/[^\r\n]/g, ' ');
}
return {
getLength: () => len,
getText: value.substring.bind(value),
getChangeRange: () => null
};
}
| src/vs/languages/typescript/common/project/snapshots.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017426164413336664,
0.0001712245721137151,
0.00016863184282556176,
0.00017078024393413216,
0.000002319732629985083
] |
{
"id": 7,
"code_window": [
"\t\t/** if true send to telemetry */\n",
"\t\tsendTelemetry?: boolean;\n",
"\t\t/** if true show user */\n",
"\t\tshowUser?: boolean;\n",
"\t}\n",
"\n",
"\t/** A Thread */\n",
"\texport interface Thread {\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t/** An optional url where additional information about this message can be found. */\n",
"\t\turl?: string;\n",
"\t\t/** An optional label that is presented to the user as the UI for opening the url. */\n",
"\t\turlLabel?: string;\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"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.
*--------------------------------------------------------------------------------------------*/
/* ---------- IE10 remove auto clear button ---------- */
::-ms-clear {
display: none;
}
.context-view .tooltip.customhover {
text-overflow: ellipsis;
overflow: hidden;
}
.monaco-workbench-container {
position: absolute;
}
.monaco-workbench {
font-size: 13px;
line-height: 1.4em;
position: relative;
z-index: 1;
overflow: hidden;
}
.monaco-workbench input {
font-size: 100%;
}
.monaco-workbench > .part {
position: absolute;
z-index: 1;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
} | src/vs/workbench/browser/media/workbench.css | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.0001732546224957332,
0.0001726530317682773,
0.00017228515935130417,
0.00017256545834243298,
3.391537291008717e-7
] |
{
"id": 7,
"code_window": [
"\t\t/** if true send to telemetry */\n",
"\t\tsendTelemetry?: boolean;\n",
"\t\t/** if true show user */\n",
"\t\tshowUser?: boolean;\n",
"\t}\n",
"\n",
"\t/** A Thread */\n",
"\texport interface Thread {\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t/** An optional url where additional information about this message can be found. */\n",
"\t\turl?: string;\n",
"\t\t/** An optional label that is presented to the user as the UI for opening the url. */\n",
"\t\turlLabel?: string;\n"
],
"file_path": "src/vs/workbench/parts/debug/common/debugProtocol.d.ts",
"type": "add",
"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.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { Builder } from 'vs/base/browser/builder';
import mockBrowserService = require('vs/base/test/browser/mockBrowserService');
suite("ProgressBar", () => {
var fixture: HTMLElement;
setup(() => {
fixture = document.createElement('div');
document.body.appendChild(fixture);
});
teardown(() => {
document.body.removeChild(fixture);
});
test("Progress Bar", function() {
var b = new Builder(fixture);
var bar = new ProgressBar(b);
assert(bar.getContainer());
assert(bar.infinite());
assert(bar.total(100));
assert(bar.worked(50));
assert(bar.worked(50));
assert(bar.done());
bar.dispose();
});
}); | src/vs/base/test/browser/progressBar.test.ts | 0 | https://github.com/microsoft/vscode/commit/44afe82ba0bbf242adbe1ce19bd2963f7544560e | [
0.00017375375318806618,
0.000171684252563864,
0.00016848076484166086,
0.00017225125338882208,
0.0000019642604911496164
] |
{
"id": 0,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {\n",
"\theight: initial;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {\n",
"\tdisplay: flex;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {\n",
"\tmargin: auto;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 208
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.settings-editor {
padding: 11px 0px 0px 27px;
margin: auto;
}
/* header styling */
.settings-editor > .settings-header {
padding: 0px 10px 0px 0px;
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-header > .settings-preview-header {
margin-bottom: 5px;
}
.settings-editor > .settings-header > .settings-preview-header .settings-preview-label {
opacity: .7;
}
.settings-editor > .settings-header > .settings-preview-header .open-settings-button,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:hover,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:active {
padding: 0;
text-decoration: underline;
display: inline;
}
.settings-editor > .settings-header > .settings-preview-header > .settings-preview-warning {
text-align: right;
text-transform: uppercase;
background: rgba(136, 136, 136, 0.3);
border-radius: 2px;
font-size: 0.8em;
padding: 0 3px;
margin-right: 7px;
}
.settings-editor > .settings-header > .search-container {
position: relative;
}
.settings-editor > .settings-header .search-container > .settings-search-input {
vertical-align: middle;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox {
height: 30px;
width: 100%;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox .input {
font-size: 14px;
padding-left: 10px;
}
.settings-editor > .settings-header > .settings-header-controls {
margin-top: 7px;
height: 30px;
display: flex;
}
.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label {
margin-left: 14px;
}
.settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon {
/** The tab widget container height is shorter than elsewhere, need to tweak this */
padding-top: 3px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right {
margin-left: auto;
padding-top: 3px;
display: flex;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right #configured-only-checkbox {
flex-shrink: 0;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .configured-only-label {
white-space: nowrap;
margin-right: 10px;
margin-left: 2px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree-wrapper {
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow.top-left-corner {
left: calc((100% - 800px)/2);
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow {
left: calc((100% - 794px)/2);
width: 800px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree::before {
outline: none !important;
}
.settings-editor > .settings-body .settings-tree-container {
flex: 1;
border-spacing: 0;
border-collapse: separate;
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item {
cursor: default;
white-space: normal;
display: flex;
height: 100%;
min-height: 75px;
}
.settings-editor > .settings-body > .settings-tree-container .monaco-tree-row .content::before {
content: ' ';
display: inline-block;
position: absolute;
width: 5px;
left: -9px;
top: 2px;
bottom: 10px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.odd:not(.focused):not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(:focus) .setting-item.focused.odd:not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(.focused) .setting-item.focused.odd:not(.selected):not(:hover) {
background-color: rgba(130, 130, 130, 0.04);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-left {
flex: 1;
padding-top: 3px;
padding-bottom: 12px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-right {
min-width: 180px;
margin: 21px 10px 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title {
line-height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-is-configured-label {
font-style: italic;
opacity: 0.8;
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-overrides {
opacity: 0.5;
font-style: italic;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label {
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
font-weight: bold;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
opacity: 0.7;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-key {
margin-left: 10px;
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
font-size: 90%;
opacity: 0.8;
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description {
opacity: 0.7;
margin-top: 3px;
height: 36px;
overflow: hidden;
white-space: pre-wrap;
}
.settings-editor > .settings-body > .settings-tree-container .setting-measure-container.monaco-tree-row {
padding-left: 15px;
opacity: 0;
max-width: 800px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-description,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {
height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {
margin: auto;
text-align: left;
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button + .setting-reset-button.monaco-button {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .monaco-select-box {
width: 100%;
font: inherit;
height: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-value-checkbox {
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-value-checkbox::after {
content: ' ';
display: block;
height: 3px;
width: 18px;
position: absolute;
top: 15px;
left: -3px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
display: inline-block;
background: url("clean.svg") center center no-repeat;
width: 16px;
height: 16px;
margin: auto;
margin-left: 3px;
visibility: hidden;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {
visibility: hidden;
position: absolute;
bottom: -2px;
width: calc(100% - 190px);
text-align: center;
opacity: .5;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {
visibility: visible;
}
.vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
background: url("clean-dark.svg") center center no-repeat;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {
visibility: visible;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button {
margin: auto;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button .monaco-button {
padding-left: 10px;
padding-right: 10px;
}
/*
Ensure the is-configured indicators can appear outside of the list items themselves:
- Disable overflow: hidden on the listrow
- Allocate some space with a margin on the list-row
- Make up for that space with a negative margin on the settings-body
This is risky, consider a different approach
*/
.settings-editor .settings-tree-container .setting-item {
overflow: visible;
}
.settings-editor .settings-body {
margin-left: -15px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label {
margin: 0px;
padding: 5px 0px;
font-size: 13px;
}
.settings-editor > .settings-body .settings-feedback-button {
color: rgb(255, 255, 255);
background-color: rgb(14, 99, 156);
position: absolute;
bottom: 0;
right: 0;
width: initial;
margin-right: 15px;
margin-bottom: 15px;
padding: 10px;
border-radius: 5px;
}
| src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.9742053151130676,
0.036864954978227615,
0.00016680890985298902,
0.0004431732522789389,
0.16905897855758667
] |
{
"id": 0,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {\n",
"\theight: initial;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {\n",
"\tdisplay: flex;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {\n",
"\tmargin: auto;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 208
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"expressionsSection": "İfadeler Bölümü",
"watchAriaTreeLabel": "Hata Ayıklama İzleme İfadeleri",
"watchExpressionPlaceholder": "İzlenecek ifade",
"watchExpressionInputAriaLabel": "İzleme ifadesi girin",
"watchExpressionAriaLabel": "{0} değeri {1}, izleme, hata ayıklama",
"watchVariableAriaLabel": "{0} değeri {1}, izleme, hata ayıklama"
} | i18n/trk/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017498593661002815,
0.00017318414757028222,
0.0001713823585305363,
0.00017318414757028222,
0.0000018017890397459269
] |
{
"id": 0,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {\n",
"\theight: initial;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {\n",
"\tdisplay: flex;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {\n",
"\tmargin: auto;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 208
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"caseDescription": "大文字と小文字を区別する",
"wordsDescription": "単語単位で検索する",
"regexDescription": "正規表現を使用する"
} | i18n/jpn/src/vs/base/browser/ui/findinput/findInputCheckboxes.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017521099653095007,
0.0001721239386824891,
0.00016903688083402812,
0.0001721239386824891,
0.0000030870578484609723
] |
{
"id": 0,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {\n",
"\theight: initial;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {\n",
"\tdisplay: flex;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {\n",
"\tmargin: auto;\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 208
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"openLaunchJson": "Apri {0}",
"launchJsonNeedsConfigurtion": "Configurare o correggere 'launch.json'",
"noFolderDebugConfig": "Si prega di aprire prima una cartella per consentire una configurazione di debug avanzato.",
"startDebug": "Avvia debug",
"startWithoutDebugging": "Avvia senza eseguire debug",
"selectAndStartDebugging": "Seleziona e avvia il debug",
"restartDebug": "Riavvia",
"reconnectDebug": "Riconnetti",
"stepOverDebug": "Esegui istruzione/routine",
"stepIntoDebug": "Esegui istruzione",
"stepOutDebug": "Esci da istruzione/routine",
"stopDebug": "Arresta",
"disconnectDebug": "Disconnetti",
"continueDebug": "Continua",
"pauseDebug": "Sospendi",
"terminateThread": "Termina thread",
"restartFrame": "Riavvia frame",
"removeBreakpoint": "Rimuovi punto di interruzione",
"removeAllBreakpoints": "Rimuovi tutti i punti di interruzione",
"enableAllBreakpoints": "Abilita tutti i punti di interruzione",
"disableAllBreakpoints": "Disabilita tutti i punti di interruzione",
"activateBreakpoints": "Attiva punti di interruzione",
"deactivateBreakpoints": "Disattiva punti di interruzione",
"reapplyAllBreakpoints": "Riapplica tutti i punti di interruzione",
"addFunctionBreakpoint": "Aggiungi punto di interruzione della funzione",
"setValue": "Imposta valore",
"addWatchExpression": "Aggiungi espressione",
"editWatchExpression": "Modifica espressione",
"addToWatchExpressions": "Aggiungi a espressione di controllo",
"removeWatchExpression": "Rimuovi espressione",
"removeAllWatchExpressions": "Rimuovi tutte le espressioni",
"clearRepl": "Cancella console",
"debugConsoleAction": "Console di debug",
"unreadOutput": "Nuovo output nella console di debug",
"debugFocusConsole": "Console di debug stato attivo",
"focusProcess": "Sposta stato attivo su processo",
"stepBackDebug": "Torna indietro",
"reverseContinue": "Inverti"
} | i18n/ita/src/vs/workbench/parts/debug/browser/debugActions.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001760644227033481,
0.00017289603420067579,
0.0001710541982902214,
0.00017226938507519662,
0.000001754579670887324
] |
{
"id": 1,
"code_window": [
"\ttop: 15px;\n",
"\tleft: -3px;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tdisplay: inline-block;\n",
"\tbackground: url(\"clean.svg\") center center no-repeat;\n",
"\twidth: 16px;\n",
"\theight: 16px;\n",
"\tmargin: auto;\n",
"\tmargin-left: 3px;\n",
"\tvisibility: hidden;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\ttext-align: left;\n",
"\tdisplay: inline;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 245
} | /*---------------------------------------------------------------------------------------------
* 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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.008211136795580387,
0.00038004538509994745,
0.00016325971228070557,
0.0001740611915010959,
0.00102174561470747
] |
{
"id": 1,
"code_window": [
"\ttop: 15px;\n",
"\tleft: -3px;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tdisplay: inline-block;\n",
"\tbackground: url(\"clean.svg\") center center no-repeat;\n",
"\twidth: 16px;\n",
"\theight: 16px;\n",
"\tmargin: auto;\n",
"\tmargin-left: 3px;\n",
"\tvisibility: hidden;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\ttext-align: left;\n",
"\tdisplay: inline;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 245
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"toggle.tabMovesFocus": "切換 TAB 鍵移動焦點"
} | i18n/cht/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017530456534586847,
0.00017444387776777148,
0.00017358317563775927,
0.00017444387776777148,
8.606948540546e-7
] |
{
"id": 1,
"code_window": [
"\ttop: 15px;\n",
"\tleft: -3px;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tdisplay: inline-block;\n",
"\tbackground: url(\"clean.svg\") center center no-repeat;\n",
"\twidth: 16px;\n",
"\theight: 16px;\n",
"\tmargin: auto;\n",
"\tmargin-left: 3px;\n",
"\tvisibility: hidden;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\ttext-align: left;\n",
"\tdisplay: inline;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 245
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"arai.alert.snippet": "L'accettazione di '{0}' ha inserito il seguente testo: {1}",
"suggest.trigger.label": "Attiva suggerimento"
} | i18n/ita/src/vs/editor/contrib/suggest/suggestController.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017607148038223386,
0.0001748403301462531,
0.00017360917991027236,
0.0001748403301462531,
0.0000012311502359807491
] |
{
"id": 1,
"code_window": [
"\ttop: 15px;\n",
"\tleft: -3px;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tdisplay: inline-block;\n",
"\tbackground: url(\"clean.svg\") center center no-repeat;\n",
"\twidth: 16px;\n",
"\theight: 16px;\n",
"\tmargin: auto;\n",
"\tmargin-left: 3px;\n",
"\tvisibility: hidden;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"\ttext-align: left;\n",
"\tdisplay: inline;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 245
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"multipleResults": "Haga clic para mostrar {0} definiciones."
} | i18n/esn/src/vs/editor/contrib/goToDeclaration/browser/goToDeclarationMouse.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017404741083737463,
0.00017404741083737463,
0.00017404741083737463,
0.00017404741083737463,
0
] |
{
"id": 2,
"code_window": [
"\tvisibility: hidden;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {\n",
"\tvisibility: hidden;\n",
"\tposition: absolute;\n",
"\tbottom: -2px;\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "add",
"edit_start_line_idx": 254
} | /*---------------------------------------------------------------------------------------------
* 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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.013766848482191563,
0.0005698857712559402,
0.00016314393724314868,
0.0001975875929929316,
0.001726829563267529
] |
{
"id": 2,
"code_window": [
"\tvisibility: hidden;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {\n",
"\tvisibility: hidden;\n",
"\tposition: absolute;\n",
"\tbottom: -2px;\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "add",
"edit_start_line_idx": 254
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"openToolsLabel": "Apri strumenti di sviluppo Webview",
"refreshWebviewLabel": "Ricarica Webview"
} | i18n/ita/src/vs/workbench/parts/html/electron-browser/webviewCommands.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001754217955749482,
0.00017481604299973696,
0.00017421029042452574,
0.00017481604299973696,
6.057525752112269e-7
] |
{
"id": 2,
"code_window": [
"\tvisibility: hidden;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {\n",
"\tvisibility: hidden;\n",
"\tposition: absolute;\n",
"\tbottom: -2px;\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "add",
"edit_start_line_idx": 254
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"gotoSymbol": "Ir al símbolo en el archivo...",
"symbols": "símbolos ({0})",
"method": "métodos ({0})",
"function": "funciones ({0})",
"_constructor": "constructores ({0})",
"variable": "variables ({0})",
"class": "clases ({0})",
"interface": "interfaces ({0})",
"namespace": "espacios de nombres ({0})",
"package": "paquetes ({0})",
"modules": "módulos ({0})",
"property": "propiedades ({0})",
"enum": "enumeraciones ({0})",
"string": "cadenas ({0})",
"rule": "reglas ({0})",
"file": "archivos ({0})",
"array": "matrices ({0})",
"number": "números ({0})",
"boolean": "booleanos ({0})",
"object": "objetos ({0})",
"key": "claves ({0})",
"entryAriaLabel": "{0}, símbolos",
"noSymbolsMatching": "No hay símbolos coincidentes",
"noSymbolsFound": "No se encontraron símbolos",
"gotoSymbolHandlerAriaLabel": "Escriba para restringir los símbolos del editor activo.",
"cannotRunGotoSymbolInFile": "No hay información de símbolos para el archivo.",
"cannotRunGotoSymbol": "Abrir un archivo de texto antes de ir a un símbolo"
} | i18n/esn/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017581444990355521,
0.00017158006085082889,
0.0001653288200031966,
0.0001725884503684938,
0.0000038481757655972615
] |
{
"id": 2,
"code_window": [
"\tvisibility: hidden;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {\n",
"\tvisibility: hidden;\n",
"\tposition: absolute;\n",
"\tbottom: -2px;\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "add",
"edit_start_line_idx": 254
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"binaryEditor": "Visualizzatore file binari"
} | i18n/ita/src/vs/workbench/browser/parts/editor/binaryEditor.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001742775784805417,
0.00017355135059915483,
0.00017282513726968318,
0.00017355135059915483,
7.262206054292619e-7
] |
{
"id": 3,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tbackground: url(\"clean-dark.svg\") center center no-repeat;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .all-settings {\n",
"\tdisplay: flex;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 267
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.settings-editor {
padding: 11px 0px 0px 27px;
margin: auto;
}
/* header styling */
.settings-editor > .settings-header {
padding: 0px 10px 0px 0px;
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-header > .settings-preview-header {
margin-bottom: 5px;
}
.settings-editor > .settings-header > .settings-preview-header .settings-preview-label {
opacity: .7;
}
.settings-editor > .settings-header > .settings-preview-header .open-settings-button,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:hover,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:active {
padding: 0;
text-decoration: underline;
display: inline;
}
.settings-editor > .settings-header > .settings-preview-header > .settings-preview-warning {
text-align: right;
text-transform: uppercase;
background: rgba(136, 136, 136, 0.3);
border-radius: 2px;
font-size: 0.8em;
padding: 0 3px;
margin-right: 7px;
}
.settings-editor > .settings-header > .search-container {
position: relative;
}
.settings-editor > .settings-header .search-container > .settings-search-input {
vertical-align: middle;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox {
height: 30px;
width: 100%;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox .input {
font-size: 14px;
padding-left: 10px;
}
.settings-editor > .settings-header > .settings-header-controls {
margin-top: 7px;
height: 30px;
display: flex;
}
.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label {
margin-left: 14px;
}
.settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon {
/** The tab widget container height is shorter than elsewhere, need to tweak this */
padding-top: 3px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right {
margin-left: auto;
padding-top: 3px;
display: flex;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right #configured-only-checkbox {
flex-shrink: 0;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .configured-only-label {
white-space: nowrap;
margin-right: 10px;
margin-left: 2px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree-wrapper {
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow.top-left-corner {
left: calc((100% - 800px)/2);
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow {
left: calc((100% - 794px)/2);
width: 800px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree::before {
outline: none !important;
}
.settings-editor > .settings-body .settings-tree-container {
flex: 1;
border-spacing: 0;
border-collapse: separate;
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item {
cursor: default;
white-space: normal;
display: flex;
height: 100%;
min-height: 75px;
}
.settings-editor > .settings-body > .settings-tree-container .monaco-tree-row .content::before {
content: ' ';
display: inline-block;
position: absolute;
width: 5px;
left: -9px;
top: 2px;
bottom: 10px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.odd:not(.focused):not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(:focus) .setting-item.focused.odd:not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(.focused) .setting-item.focused.odd:not(.selected):not(:hover) {
background-color: rgba(130, 130, 130, 0.04);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-left {
flex: 1;
padding-top: 3px;
padding-bottom: 12px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-right {
min-width: 180px;
margin: 21px 10px 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title {
line-height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-is-configured-label {
font-style: italic;
opacity: 0.8;
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-overrides {
opacity: 0.5;
font-style: italic;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label {
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
font-weight: bold;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
opacity: 0.7;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-key {
margin-left: 10px;
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
font-size: 90%;
opacity: 0.8;
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description {
opacity: 0.7;
margin-top: 3px;
height: 36px;
overflow: hidden;
white-space: pre-wrap;
}
.settings-editor > .settings-body > .settings-tree-container .setting-measure-container.monaco-tree-row {
padding-left: 15px;
opacity: 0;
max-width: 800px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-description,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {
height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {
margin: auto;
text-align: left;
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button + .setting-reset-button.monaco-button {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .monaco-select-box {
width: 100%;
font: inherit;
height: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-value-checkbox {
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-value-checkbox::after {
content: ' ';
display: block;
height: 3px;
width: 18px;
position: absolute;
top: 15px;
left: -3px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
display: inline-block;
background: url("clean.svg") center center no-repeat;
width: 16px;
height: 16px;
margin: auto;
margin-left: 3px;
visibility: hidden;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {
visibility: hidden;
position: absolute;
bottom: -2px;
width: calc(100% - 190px);
text-align: center;
opacity: .5;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {
visibility: visible;
}
.vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
background: url("clean-dark.svg") center center no-repeat;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {
visibility: visible;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button {
margin: auto;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button .monaco-button {
padding-left: 10px;
padding-right: 10px;
}
/*
Ensure the is-configured indicators can appear outside of the list items themselves:
- Disable overflow: hidden on the listrow
- Allocate some space with a margin on the list-row
- Make up for that space with a negative margin on the settings-body
This is risky, consider a different approach
*/
.settings-editor .settings-tree-container .setting-item {
overflow: visible;
}
.settings-editor .settings-body {
margin-left: -15px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label {
margin: 0px;
padding: 5px 0px;
font-size: 13px;
}
.settings-editor > .settings-body .settings-feedback-button {
color: rgb(255, 255, 255);
background-color: rgb(14, 99, 156);
position: absolute;
bottom: 0;
right: 0;
width: initial;
margin-right: 15px;
margin-bottom: 15px;
padding: 10px;
border-radius: 5px;
}
| src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.9928441643714905,
0.053510576486587524,
0.00016423367196694016,
0.0006208071135915816,
0.20633864402770996
] |
{
"id": 3,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tbackground: url(\"clean-dark.svg\") center center no-repeat;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .all-settings {\n",
"\tdisplay: flex;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 267
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"referencesFailre": "Fehler beim Auflösen der Datei.",
"referencesCount": "{0} Verweise",
"referenceCount": "{0} Verweis",
"missingPreviewMessage": "Keine Vorschau verfügbar.",
"treeAriaLabel": "Verweise",
"noResults": "Keine Ergebnisse",
"peekView.alternateTitle": "Verweise",
"peekViewTitleBackground": "Hintergrundfarbe des Titelbereichs der Peek-Ansicht.",
"peekViewTitleForeground": "Farbe des Titels in der Peek-Ansicht.",
"peekViewTitleInfoForeground": "Farbe der Titelinformationen in der Peek-Ansicht.",
"peekViewBorder": "Farbe der Peek-Ansichtsränder und des Pfeils.",
"peekViewResultsBackground": "Hintergrundfarbe der Ergebnisliste in der Peek-Ansicht.",
"peekViewResultsMatchForeground": "Vordergrundfarbe für Zeilenknoten in der Ergebnisliste der Peek-Ansicht.",
"peekViewResultsFileForeground": "Vordergrundfarbe für Dateiknoten in der Ergebnisliste der Peek-Ansicht.",
"peekViewResultsSelectionBackground": "Hintergrundfarbe des ausgewählten Eintrags in der Ergebnisliste der Peek-Ansicht.",
"peekViewResultsSelectionForeground": "Vordergrundfarbe des ausgewählten Eintrags in der Ergebnisliste der Peek-Ansicht.",
"peekViewEditorBackground": "Hintergrundfarbe des Peek-Editors.",
"peekViewEditorGutterBackground": "Hintergrundfarbe der Leiste im Peek-Editor.",
"peekViewResultsMatchHighlight": "Farbe für Übereinstimmungsmarkierungen in der Ergebnisliste der Peek-Ansicht.",
"peekViewEditorMatchHighlight": "Farbe für Übereinstimmungsmarkierungen im Peek-Editor.",
"peekViewEditorMatchHighlightBorder": "Rahmen für Übereinstimmungsmarkierungen im Peek-Editor."
} | i18n/deu/src/vs/editor/contrib/referenceSearch/referencesWidget.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017776258755475283,
0.00017345168453175575,
0.00016956491163000464,
0.0001732396485749632,
0.0000029319924124138197
] |
{
"id": 3,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tbackground: url(\"clean-dark.svg\") center center no-repeat;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .all-settings {\n",
"\tdisplay: flex;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 267
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"label.close": "Bezárás"
} | i18n/hun/src/vs/editor/contrib/referenceSearch/browser/peekViewWidget.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017531978664919734,
0.00017531978664919734,
0.00017531978664919734,
0.00017531978664919734,
0
] |
{
"id": 3,
"code_window": [
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tbackground: url(\"clean-dark.svg\") center center no-repeat;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {\n",
"\tvisibility: visible;\n",
"}\n",
"\n",
".settings-editor > .settings-body > .settings-tree-container .all-settings {\n",
"\tdisplay: flex;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css",
"type": "replace",
"edit_start_line_idx": 267
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"compareLabels": "{0} ↔ {1}"
} | i18n/deu/src/vs/workbench/services/editor/browser/editorService.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017518526874482632,
0.00017518526874482632,
0.00017518526874482632,
0.00017518526874482632,
0
] |
{
"id": 4,
"code_window": [
" *--------------------------------------------------------------------------------------------*/\n",
"\n",
"import * as DOM from 'vs/base/browser/dom';\n",
"import { Button } from 'vs/base/browser/ui/button/button';\n",
"import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';\n",
"import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';\n",
"import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 6
} | /*---------------------------------------------------------------------------------------------
* 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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.24366968870162964,
0.003943650983273983,
0.00016395328566432,
0.00017213162209372967,
0.02996610850095749
] |
{
"id": 4,
"code_window": [
" *--------------------------------------------------------------------------------------------*/\n",
"\n",
"import * as DOM from 'vs/base/browser/dom';\n",
"import { Button } from 'vs/base/browser/ui/button/button';\n",
"import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';\n",
"import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';\n",
"import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 6
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"displayName": "Markdown Dili Özellikleri",
"description": "Markdown için zengin dil desteği sağlar.",
"markdown.preview.breaks.desc": "Markdown önizlemesinde satır sonlarının nasıl gösterileceğini ayarlar. 'true' olarak ayarlamak, her yeni satırda bir <br> oluşturur.",
"markdown.preview.linkify": "Markdown önizlemesinde URL benzeri metinlerin bağlantıya çevrilmesini etkinleştir veya devre dışı bırak.",
"markdown.preview.doubleClickToSwitchToEditor.desc": "Düzenleyiciye geçiş yapmak için Markdown önizlemesine çift tıklayın.",
"markdown.preview.fontFamily.desc": "Markdown önizlemesinde kullanılan yazı tipi ailesini denetler.",
"markdown.preview.fontSize.desc": "Markdown önizlemesinde kullanılan yazı tipi boyutunu piksel olarak denetler.",
"markdown.preview.lineHeight.desc": "Markdown önizlemesinde kullanılan satır yüksekliğini denetler. Bu sayı yazı tipi boyutuna görecelidir.",
"markdown.preview.markEditorSelection.desc": "Markdown önizlemesinde geçerli düzenleyici seçimini işaretle.",
"markdown.preview.scrollEditorWithPreview.desc": "Markdown önizlemesi kaydırıldığında, düzenleyicinin görünümünü güncelle.",
"markdown.preview.scrollPreviewWithEditor.desc": "Markdown düzenleyicisi kaydırıldığında, önizlemenin görünümünü güncelle.",
"markdown.preview.scrollPreviewWithEditorSelection.desc": "[Kullanım Dışı] Düzenleyicide seçili satırın görünmesi için Markdown önizlemesini kaydırır.",
"markdown.preview.scrollPreviewWithEditorSelection.deprecationMessage": "Bu ayar 'markdown.preview.scrollPreviewWithEditor' ile değiştirildi ve artık hiçbir etkisi bulunmamaktadır.",
"markdown.preview.title": "Önizlemeyi Aç",
"markdown.previewFrontMatter.dec": "YAML ön maddesinin Markdown önizlemesinde nasıl gösterilmesi gerektiğini ayarlar. 'hide' ön maddeyi kaldırır. Diğer türlü; ön madde, Markdown içeriği olarak sayılır.",
"markdown.previewSide.title": "Önizlemeyi Yana Aç",
"markdown.showLockedPreviewToSide.title": "Kilitlenmiş Önizlemeyi Yana Aç",
"markdown.showSource.title": "Kaynağı Göster",
"markdown.styles.dec": "Markdown önizlemesinde kullanılmak üzere CSS stil dosyalarını işaret eden bir URL'ler veya yerel yollar listesi. Göreli yollar, gezginde açılan klasöre göreli olarak yorumlanır.",
"markdown.showPreviewSecuritySelector.title": "Önizleme Güvenlik Ayarlarını Değiştir",
"markdown.trace.desc": "Markdown eklentisi için hata ayıklama günlüğünü etkinleştir.",
"markdown.preview.refresh.title": "Önizlemeyi Yenile",
"markdown.preview.toggleLock.title": "Önizleme Kilitlemeyi Aç/Kapat"
} | i18n/trk/extensions/markdown/package.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001763792970450595,
0.00016903207870200276,
0.00016517093172296882,
0.00016728905029594898,
0.000004565942163026193
] |
{
"id": 4,
"code_window": [
" *--------------------------------------------------------------------------------------------*/\n",
"\n",
"import * as DOM from 'vs/base/browser/dom';\n",
"import { Button } from 'vs/base/browser/ui/button/button';\n",
"import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';\n",
"import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';\n",
"import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 6
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"yes": "Igen",
"no": "Nem",
"not now": "Kérdezzen rá később",
"suggest auto fetch": "Szeretné, hogy a Code [időszakosan futtassa a 'git fetch' parancsot]({0})?"
} | i18n/hun/extensions/git/out/autofetch.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017698445299174637,
0.0001748986978782341,
0.0001728129427647218,
0.0001748986978782341,
0.0000020857551135122776
] |
{
"id": 4,
"code_window": [
" *--------------------------------------------------------------------------------------------*/\n",
"\n",
"import * as DOM from 'vs/base/browser/dom';\n",
"import { Button } from 'vs/base/browser/ui/button/button';\n",
"import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';\n",
"import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';\n",
"import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 6
} | {
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true,
"target": "es2016",
"strictNullChecks": true,
"noUnusedParameters": false,
"noUnusedLocals": true,
"outDir": "out",
"sourceMap": true,
"lib": [
"es2016",
"dom"
]
},
"exclude": [
"node_modules"
]
} | test/smoke/tsconfig.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017508157179690897,
0.00017322694475296885,
0.0001703849993646145,
0.0001742142776492983,
0.0000020405163922987413
] |
{
"id": 5,
"code_window": [
"import { Color } from 'vs/base/common/color';\n",
"import { Emitter, Event } from 'vs/base/common/event';\n",
"import { dispose, IDisposable } from 'vs/base/common/lifecycle';\n",
"import * as objects from 'vs/base/common/objects';\n",
"import { TPromise } from 'vs/base/common/winjs.base';\n",
"import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';\n",
"import { localize } from 'vs/nls';\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"import URI from 'vs/base/common/uri';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 14
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.settings-editor {
padding: 11px 0px 0px 27px;
margin: auto;
}
/* header styling */
.settings-editor > .settings-header {
padding: 0px 10px 0px 0px;
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-header > .settings-preview-header {
margin-bottom: 5px;
}
.settings-editor > .settings-header > .settings-preview-header .settings-preview-label {
opacity: .7;
}
.settings-editor > .settings-header > .settings-preview-header .open-settings-button,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:hover,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:active {
padding: 0;
text-decoration: underline;
display: inline;
}
.settings-editor > .settings-header > .settings-preview-header > .settings-preview-warning {
text-align: right;
text-transform: uppercase;
background: rgba(136, 136, 136, 0.3);
border-radius: 2px;
font-size: 0.8em;
padding: 0 3px;
margin-right: 7px;
}
.settings-editor > .settings-header > .search-container {
position: relative;
}
.settings-editor > .settings-header .search-container > .settings-search-input {
vertical-align: middle;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox {
height: 30px;
width: 100%;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox .input {
font-size: 14px;
padding-left: 10px;
}
.settings-editor > .settings-header > .settings-header-controls {
margin-top: 7px;
height: 30px;
display: flex;
}
.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label {
margin-left: 14px;
}
.settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon {
/** The tab widget container height is shorter than elsewhere, need to tweak this */
padding-top: 3px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right {
margin-left: auto;
padding-top: 3px;
display: flex;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right #configured-only-checkbox {
flex-shrink: 0;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .configured-only-label {
white-space: nowrap;
margin-right: 10px;
margin-left: 2px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree-wrapper {
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow.top-left-corner {
left: calc((100% - 800px)/2);
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow {
left: calc((100% - 794px)/2);
width: 800px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree::before {
outline: none !important;
}
.settings-editor > .settings-body .settings-tree-container {
flex: 1;
border-spacing: 0;
border-collapse: separate;
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item {
cursor: default;
white-space: normal;
display: flex;
height: 100%;
min-height: 75px;
}
.settings-editor > .settings-body > .settings-tree-container .monaco-tree-row .content::before {
content: ' ';
display: inline-block;
position: absolute;
width: 5px;
left: -9px;
top: 2px;
bottom: 10px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.odd:not(.focused):not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(:focus) .setting-item.focused.odd:not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(.focused) .setting-item.focused.odd:not(.selected):not(:hover) {
background-color: rgba(130, 130, 130, 0.04);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-left {
flex: 1;
padding-top: 3px;
padding-bottom: 12px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-right {
min-width: 180px;
margin: 21px 10px 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title {
line-height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-is-configured-label {
font-style: italic;
opacity: 0.8;
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-overrides {
opacity: 0.5;
font-style: italic;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label {
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
font-weight: bold;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
opacity: 0.7;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-key {
margin-left: 10px;
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
font-size: 90%;
opacity: 0.8;
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description {
opacity: 0.7;
margin-top: 3px;
height: 36px;
overflow: hidden;
white-space: pre-wrap;
}
.settings-editor > .settings-body > .settings-tree-container .setting-measure-container.monaco-tree-row {
padding-left: 15px;
opacity: 0;
max-width: 800px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-description,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {
height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {
margin: auto;
text-align: left;
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button + .setting-reset-button.monaco-button {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .monaco-select-box {
width: 100%;
font: inherit;
height: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-value-checkbox {
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-value-checkbox::after {
content: ' ';
display: block;
height: 3px;
width: 18px;
position: absolute;
top: 15px;
left: -3px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
display: inline-block;
background: url("clean.svg") center center no-repeat;
width: 16px;
height: 16px;
margin: auto;
margin-left: 3px;
visibility: hidden;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {
visibility: hidden;
position: absolute;
bottom: -2px;
width: calc(100% - 190px);
text-align: center;
opacity: .5;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {
visibility: visible;
}
.vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
background: url("clean-dark.svg") center center no-repeat;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {
visibility: visible;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button {
margin: auto;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button .monaco-button {
padding-left: 10px;
padding-right: 10px;
}
/*
Ensure the is-configured indicators can appear outside of the list items themselves:
- Disable overflow: hidden on the listrow
- Allocate some space with a margin on the list-row
- Make up for that space with a negative margin on the settings-body
This is risky, consider a different approach
*/
.settings-editor .settings-tree-container .setting-item {
overflow: visible;
}
.settings-editor .settings-body {
margin-left: -15px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label {
margin: 0px;
padding: 5px 0px;
font-size: 13px;
}
.settings-editor > .settings-body .settings-feedback-button {
color: rgb(255, 255, 255);
background-color: rgb(14, 99, 156);
position: absolute;
bottom: 0;
right: 0;
width: initial;
margin-right: 15px;
margin-bottom: 15px;
padding: 10px;
border-radius: 5px;
}
| src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017579837003722787,
0.00017248239601030946,
0.00016818319272715598,
0.00017263655900023878,
0.0000015812817082405672
] |
{
"id": 5,
"code_window": [
"import { Color } from 'vs/base/common/color';\n",
"import { Emitter, Event } from 'vs/base/common/event';\n",
"import { dispose, IDisposable } from 'vs/base/common/lifecycle';\n",
"import * as objects from 'vs/base/common/objects';\n",
"import { TPromise } from 'vs/base/common/winjs.base';\n",
"import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';\n",
"import { localize } from 'vs/nls';\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"import URI from 'vs/base/common/uri';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 14
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"collapse": "Összecsukás"
} | i18n/hun/src/vs/base/parts/tree/browser/treeDefaults.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017784313240554184,
0.0001753455144353211,
0.00017284789646510035,
0.0001753455144353211,
0.0000024976179702207446
] |
{
"id": 5,
"code_window": [
"import { Color } from 'vs/base/common/color';\n",
"import { Emitter, Event } from 'vs/base/common/event';\n",
"import { dispose, IDisposable } from 'vs/base/common/lifecycle';\n",
"import * as objects from 'vs/base/common/objects';\n",
"import { TPromise } from 'vs/base/common/winjs.base';\n",
"import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';\n",
"import { localize } from 'vs/nls';\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"import URI from 'vs/base/common/uri';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 14
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"textDiffEditor": "Textdiff-Editor",
"readonlyEditorWithInputAriaLabel": "{0}. Schreibgeschützter Textvergleichs-Editor.",
"readonlyEditorAriaLabel": "Schreibgeschützter Textvergleichs-Editor.",
"editableEditorWithInputAriaLabel": "{0}. Textdateivergleichs-Editor.",
"editableEditorAriaLabel": "Textdateivergleichs-Editor",
"navigate.next.label": "Nächste Änderung",
"navigate.prev.label": "Vorherige Änderung",
"toggleIgnoreTrimWhitespace.label": "Keine Leerzeichen entfernen"
} | i18n/deu/src/vs/workbench/browser/parts/editor/textDiffEditor.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001769608206814155,
0.00017568611656315625,
0.000174411412444897,
0.00017568611656315625,
0.0000012747041182592511
] |
{
"id": 5,
"code_window": [
"import { Color } from 'vs/base/common/color';\n",
"import { Emitter, Event } from 'vs/base/common/event';\n",
"import { dispose, IDisposable } from 'vs/base/common/lifecycle';\n",
"import * as objects from 'vs/base/common/objects';\n",
"import { TPromise } from 'vs/base/common/winjs.base';\n",
"import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';\n",
"import { localize } from 'vs/nls';\n"
],
"labels": [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"import URI from 'vs/base/common/uri';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "add",
"edit_start_line_idx": 14
} | {
"name": "vb",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
"scripts": {
"update-grammar": "node ../../build/npm/update-grammar.js textmate/asp.vb.net.tmbundle Syntaxes/ASP%20VB.net.plist ./syntaxes/asp-vb-net.tmlanguage.json"
},
"contributes": {
"languages": [{
"id": "vb",
"extensions": [ ".vb", ".brs", ".vbs", ".bas" ],
"aliases": [ "Visual Basic", "vb" ],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "vb",
"scopeName": "source.asp.vb.net",
"path": "./syntaxes/asp-vb-net.tmlanguage.json"
}],
"snippets": [{
"language": "vb",
"path": "./snippets/vb.json"
}]
}
}
| extensions/vb/package.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017526847659610212,
0.00017341109924018383,
0.0001714140671538189,
0.00017355075397063047,
0.000001576651584400679
] |
{
"id": 6,
"code_window": [
"import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';\n",
"import { IContextViewService } from 'vs/platform/contextview/browser/contextView';\n",
"import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';\n",
"import { registerColor } from 'vs/platform/theme/common/colorRegistry';\n",
"import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';\n",
"import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';\n",
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { editorActiveLinkForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.11729814857244492,
0.00236085569486022,
0.0001629307953407988,
0.0001719518331810832,
0.014441804960370064
] |
{
"id": 6,
"code_window": [
"import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';\n",
"import { IContextViewService } from 'vs/platform/contextview/browser/contextView';\n",
"import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';\n",
"import { registerColor } from 'vs/platform/theme/common/colorRegistry';\n",
"import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';\n",
"import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';\n",
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { editorActiveLinkForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.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.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"languageSpecificEditorSettings": "Impostazioni dell'editor specifiche del linguaggio",
"languageSpecificEditorSettingsDescription": "Esegue l'override delle impostazioni dell'editor per il linguaggio"
} | i18n/ita/extensions/extension-editing/out/packageDocumentHelper.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017700805619824678,
0.0001737808925099671,
0.0001705537288216874,
0.0001737808925099671,
0.0000032271636882796884
] |
{
"id": 6,
"code_window": [
"import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';\n",
"import { IContextViewService } from 'vs/platform/contextview/browser/contextView';\n",
"import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';\n",
"import { registerColor } from 'vs/platform/theme/common/colorRegistry';\n",
"import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';\n",
"import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';\n",
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { editorActiveLinkForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.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.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"jsonParseFail": "Échec de l'analyse de {0} : {1}.",
"fileReadFail": "Impossible de lire le fichier {0} : {1}.",
"jsonsParseReportErrors": "Échec de l'analyse de {0} : {1}.",
"missingNLSKey": "Le message est introuvable pour la clé {0}."
} | i18n/fra/src/vs/workbench/services/extensions/electron-browser/extensionPoints.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001773547410266474,
0.0001750817900756374,
0.0001728088391246274,
0.0001750817900756374,
0.0000022729509510099888
] |
{
"id": 6,
"code_window": [
"import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';\n",
"import { IContextViewService } from 'vs/platform/contextview/browser/contextView';\n",
"import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';\n",
"import { registerColor } from 'vs/platform/theme/common/colorRegistry';\n",
"import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';\n",
"import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';\n",
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
],
"after_edit": [
"import { editorActiveLinkForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.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.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"welcomePage": "Benvenuti",
"welcomePage.javaScript": "JavaScript",
"welcomePage.typeScript": "TypeScript",
"welcomePage.python": "Python",
"welcomePage.php": "PHP",
"welcomePage.azure": "Azure",
"welcomePage.showAzureExtensions": "Mostra estensioni di Azure",
"welcomePage.docker": "Docker",
"welcomePage.vim": "Vim",
"welcomePage.sublime": "Sublime",
"welcomePage.atom": "Atom",
"welcomePage.extensionPackAlreadyInstalled": "Il supporto per {0} è già installato.",
"welcomePage.willReloadAfterInstallingExtensionPack": "La finestra verrà ricaricata dopo l'installazione di supporto aggiuntivo per {0}.",
"welcomePage.installingExtensionPack": "Installazione di supporto aggiuntivo per {0} in corso...",
"welcomePage.extensionPackNotFound": "Il supporto per {0} con ID {1} non è stato trovato.",
"welcomePage.keymapAlreadyInstalled": "I tasti di scelta rapida di {0} sono già installati.",
"welcomePage.willReloadAfterInstallingKeymap": "La finestra verrà ricaricata dopo l'installazione dei tasti di scelta rapida di {0}.",
"welcomePage.installingKeymap": "Installazione dei tasti di scelta rapida di {0}...",
"welcomePage.keymapNotFound": "I tasti di scelta rapida di {0} con ID {1} non sono stati trovati.",
"welcome.title": "Benvenuti",
"welcomePage.openFolderWithPath": "Apri la cartella {0} con percorso {1}",
"welcomePage.extensionListSeparator": ",",
"welcomePage.installKeymap": "Installa mappatura tastiera {0}",
"welcomePage.installExtensionPack": "Installa supporto aggiuntivo per {0}",
"welcomePage.installedKeymap": "Mappatura tastiera {0} è già installata",
"welcomePage.installedExtensionPack": "Il supporto {0} è già installato",
"ok": "OK",
"details": "Dettagli",
"welcomePage.buttonBackground": "Colore di sfondo dei pulsanti nella pagina di benvenuto.",
"welcomePage.buttonHoverBackground": "Colore di sfondo al passaggio del mouse dei pulsanti nella pagina di benvenuto."
} | i18n/ita/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017680160817690194,
0.00017388003470841795,
0.00017114066577050835,
0.00017378892516717315,
0.000002602058884804137
] |
{
"id": 7,
"code_window": [
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n",
"import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';\n",
"import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';\n",
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n",
"import URI from 'vs/base/common/uri';\n",
"\n",
"const $ = DOM.$;\n",
"\n",
"export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {\n",
"\tlight: '#019001',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 26
} | /*---------------------------------------------------------------------------------------------
* 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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.9978309273719788,
0.04670676961541176,
0.0001630608894629404,
0.0001721606677165255,
0.20908422768115997
] |
{
"id": 7,
"code_window": [
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n",
"import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';\n",
"import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';\n",
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n",
"import URI from 'vs/base/common/uri';\n",
"\n",
"const $ = DOM.$;\n",
"\n",
"export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {\n",
"\tlight: '#019001',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 26
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Do not edit this file. It is machine generated.
{
"reflectCSSValue": "Emmet: Reflejar valor CSS"
} | i18n/esn/src/vs/workbench/parts/emmet/node/actions/reflectCssValue.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017505184223409742,
0.00017505184223409742,
0.00017505184223409742,
0.00017505184223409742,
0
] |
{
"id": 7,
"code_window": [
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n",
"import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';\n",
"import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';\n",
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n",
"import URI from 'vs/base/common/uri';\n",
"\n",
"const $ = DOM.$;\n",
"\n",
"export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {\n",
"\tlight: '#019001',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 26
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"quickInputBox.ariaLabel": "Введите текст, чтобы уменьшить число результатов."
} | i18n/rus/src/vs/workbench/browser/parts/quickinput/quickInputBox.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001768724323483184,
0.00017385638784617186,
0.00017084035789594054,
0.00017385638784617186,
0.000003016037226188928
] |
{
"id": 7,
"code_window": [
"import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';\n",
"import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';\n",
"import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';\n",
"import { IMouseEvent } from 'vs/base/browser/mouseEvent';\n",
"import URI from 'vs/base/common/uri';\n",
"\n",
"const $ = DOM.$;\n",
"\n",
"export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {\n",
"\tlight: '#019001',\n"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 26
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"InPlaceReplaceAction.previous.label": "Reemplazar con el valor anterior",
"InPlaceReplaceAction.next.label": "Reemplazar con el valor siguiente"
} | i18n/esn/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017824274254962802,
0.0001755890843924135,
0.0001729354407871142,
0.0001755890843924135,
0.000002653650881256908
] |
{
"id": 8,
"code_window": [
"\n",
"\t\tthis.renderValue(element, isSelected, template);\n",
"\n",
"\t\tconst resetButton = new Button(template.valueElement);\n",
"\t\tresetButton.element.title = localize('resetButtonTitle', \"Reset\");\n",
"\t\tresetButton.element.classList.add('setting-reset-button');\n",
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tconst resetText = localize('resetButtonTitle', \"reset\");\n",
"\t\tresetButton.label = resetText;\n",
"\t\tresetButton.element.title = resetText;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 431
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.settings-editor {
padding: 11px 0px 0px 27px;
margin: auto;
}
/* header styling */
.settings-editor > .settings-header {
padding: 0px 10px 0px 0px;
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-header > .settings-preview-header {
margin-bottom: 5px;
}
.settings-editor > .settings-header > .settings-preview-header .settings-preview-label {
opacity: .7;
}
.settings-editor > .settings-header > .settings-preview-header .open-settings-button,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:hover,
.settings-editor > .settings-header > .settings-preview-header .open-settings-button:active {
padding: 0;
text-decoration: underline;
display: inline;
}
.settings-editor > .settings-header > .settings-preview-header > .settings-preview-warning {
text-align: right;
text-transform: uppercase;
background: rgba(136, 136, 136, 0.3);
border-radius: 2px;
font-size: 0.8em;
padding: 0 3px;
margin-right: 7px;
}
.settings-editor > .settings-header > .search-container {
position: relative;
}
.settings-editor > .settings-header .search-container > .settings-search-input {
vertical-align: middle;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox {
height: 30px;
width: 100%;
}
.settings-editor > .settings-header .search-container > .settings-search-input > .monaco-inputbox .input {
font-size: 14px;
padding-left: 10px;
}
.settings-editor > .settings-header > .settings-header-controls {
margin-top: 7px;
height: 30px;
display: flex;
}
.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item:not(:first-child) .action-label {
margin-left: 14px;
}
.settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon {
/** The tab widget container height is shorter than elsewhere, need to tweak this */
padding-top: 3px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right {
margin-left: auto;
padding-top: 3px;
display: flex;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right #configured-only-checkbox {
flex-shrink: 0;
}
.settings-editor > .settings-header > .settings-header-controls .settings-header-controls-right .configured-only-label {
white-space: nowrap;
margin-right: 10px;
margin-left: 2px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree-wrapper {
max-width: 800px;
margin: auto;
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow.top-left-corner {
left: calc((100% - 800px)/2);
}
.settings-editor > .settings-body .settings-tree-container .monaco-scrollable-element .shadow {
left: calc((100% - 794px)/2);
width: 800px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-tree::before {
outline: none !important;
}
.settings-editor > .settings-body .settings-tree-container {
flex: 1;
border-spacing: 0;
border-collapse: separate;
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item {
cursor: default;
white-space: normal;
display: flex;
height: 100%;
min-height: 75px;
}
.settings-editor > .settings-body > .settings-tree-container .monaco-tree-row .content::before {
content: ' ';
display: inline-block;
position: absolute;
width: 5px;
left: -9px;
top: 2px;
bottom: 10px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.odd:not(.focused):not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(:focus) .setting-item.focused.odd:not(.selected):not(:hover),
.settings-editor > .settings-body > .settings-tree-container .monaco-tree:not(.focused) .setting-item.focused.odd:not(.selected):not(:hover) {
background-color: rgba(130, 130, 130, 0.04);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-left {
flex: 1;
padding-top: 3px;
padding-bottom: 12px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item > .setting-item-right {
min-width: 180px;
margin: 21px 10px 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title {
line-height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-is-configured-label {
font-style: italic;
opacity: 0.8;
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-title .setting-item-overrides {
opacity: 0.5;
font-style: italic;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label {
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-label,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
font-weight: bold;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-category {
opacity: 0.7;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-key {
margin-left: 10px;
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
font-size: 90%;
opacity: 0.8;
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-description {
opacity: 0.7;
margin-top: 3px;
height: 36px;
overflow: hidden;
white-space: pre-wrap;
}
.settings-editor > .settings-body > .settings-tree-container .setting-measure-container.monaco-tree-row {
padding-left: 15px;
opacity: 0;
max-width: 800px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expanded .setting-item-description,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-measure-helper .setting-item-description {
height: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:hover,
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button:active {
margin: auto;
text-align: left;
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .edit-in-settings-button + .setting-reset-button.monaco-button {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .monaco-select-box {
width: 100%;
font: inherit;
height: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-value-checkbox {
position: relative;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-value-checkbox::after {
content: ' ';
display: block;
height: 3px;
width: 18px;
position: absolute;
top: 15px;
left: -3px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
display: inline-block;
background: url("clean.svg") center center no-repeat;
width: 16px;
height: 16px;
margin: auto;
margin-left: 3px;
visibility: hidden;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .expand-indicator {
visibility: hidden;
position: absolute;
bottom: -2px;
width: calc(100% - 190px);
text-align: center;
opacity: .5;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-expandable .expand-indicator {
visibility: visible;
}
.vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-value > .setting-reset-button.monaco-button {
background: url("clean-dark.svg") center center no-repeat;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-value > .setting-reset-button.monaco-button {
visibility: visible;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button {
margin: auto;
}
.settings-editor > .settings-body > .settings-tree-container .all-settings .all-settings-button .monaco-button {
padding-left: 10px;
padding-right: 10px;
}
/*
Ensure the is-configured indicators can appear outside of the list items themselves:
- Disable overflow: hidden on the listrow
- Allocate some space with a margin on the list-row
- Make up for that space with a negative margin on the settings-body
This is risky, consider a different approach
*/
.settings-editor .settings-tree-container .setting-item {
overflow: visible;
}
.settings-editor .settings-body {
margin-left: -15px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label {
margin: 0px;
padding: 5px 0px;
font-size: 13px;
}
.settings-editor > .settings-body .settings-feedback-button {
color: rgb(255, 255, 255);
background-color: rgb(14, 99, 156);
position: absolute;
bottom: 0;
right: 0;
width: initial;
margin-right: 15px;
margin-bottom: 15px;
padding: 10px;
border-radius: 5px;
}
| src/vs/workbench/parts/preferences/browser/media/settingsEditor2.css | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001818597229430452,
0.000171970299561508,
0.00016593257896602154,
0.00017207255586981773,
0.0000032186358112085145
] |
{
"id": 8,
"code_window": [
"\n",
"\t\tthis.renderValue(element, isSelected, template);\n",
"\n",
"\t\tconst resetButton = new Button(template.valueElement);\n",
"\t\tresetButton.element.title = localize('resetButtonTitle', \"Reset\");\n",
"\t\tresetButton.element.classList.add('setting-reset-button');\n",
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tconst resetText = localize('resetButtonTitle', \"reset\");\n",
"\t\tresetButton.label = resetText;\n",
"\t\tresetButton.element.title = resetText;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 431
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"extensionHostProcess.startupFailDebug": "延伸主機未於 10 秒內開始,可能在第一行就已停止,並需要偵錯工具才能繼續。",
"extensionHostProcess.startupFail": "延伸主機未在 10 秒內啟動,可能發生了問題。",
"reloadWindow": "重新載入視窗",
"extensionHostProcess.error": "延伸主機發生錯誤: {0}"
} | i18n/cht/src/vs/workbench/services/extensions/electron-browser/extensionHost.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017562076391186565,
0.00017419923096895218,
0.00017277771257795393,
0.00017419923096895218,
0.0000014215256669558585
] |
{
"id": 8,
"code_window": [
"\n",
"\t\tthis.renderValue(element, isSelected, template);\n",
"\n",
"\t\tconst resetButton = new Button(template.valueElement);\n",
"\t\tresetButton.element.title = localize('resetButtonTitle', \"Reset\");\n",
"\t\tresetButton.element.classList.add('setting-reset-button');\n",
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tconst resetText = localize('resetButtonTitle', \"reset\");\n",
"\t\tresetButton.label = resetText;\n",
"\t\tresetButton.element.title = resetText;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 431
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"newFile": "新しいファイル",
"newFolder": "新しいフォルダー",
"rename": "名前変更",
"delete": "削除",
"copyFile": "コピー",
"pasteFile": "貼り付け",
"retry": "再試行",
"renameWhenSourcePathIsParentOfTargetError": "既存のフォルダーに子を追加するには 'New Folder' や 'New File' コマンドを使用してください",
"newUntitledFile": "無題の新規ファイル",
"createNewFile": "新しいファイル",
"createNewFolder": "新しいフォルダー",
"deleteButtonLabelRecycleBin": "ごみ箱に移動(&&M)",
"deleteButtonLabelTrash": "ごみ箱に移動(&&M)",
"deleteButtonLabel": "削除(&&D)",
"dirtyMessageFilesDelete": "保存されていない変更があるファイルを削除します。続行しますか?",
"dirtyMessageFolderOneDelete": "保存されていない変更がある 1 個のファイルを含むフォルダーを削除します。続行しますか?",
"dirtyMessageFolderDelete": "保存されていない変更があるファイルを {0} 個含むフォルダーを削除します。続行しますか?",
"dirtyMessageFileDelete": "保存されていない変更があるファイルを削除します。続行しますか?",
"dirtyWarning": "保存しないと変更内容が失われます。",
"undoBin": "ごみ箱から復元できます。",
"undoTrash": "ごみ箱から復元できます。",
"doNotAskAgain": "再度表示しない",
"irreversible": "このアクションは元に戻すことができません。",
"binFailed": "ごみ箱を使用した削除に失敗しました。代わりに完全に削除しますか?",
"trashFailed": "ごみ箱を使用した削除に失敗しました。代わりに完全に削除しますか?",
"deletePermanentlyButtonLabel": "完全に削除(&&D)",
"retryButtonLabel": "再試行(&&R)",
"confirmMoveTrashMessageFilesAndDirectories": "次の {0} ファイル/ディレクトリとその内容を削除しますか?",
"confirmMoveTrashMessageMultipleDirectories": "次の {0} ディレクトリとその内容を削除しますか?",
"confirmMoveTrashMessageMultiple": "次の {0} 個のファイルを削除してもよろしいですか?",
"confirmMoveTrashMessageFolder": "'{0}' とその内容を削除しますか?",
"confirmMoveTrashMessageFile": "'{0}' を削除しますか?",
"confirmDeleteMessageFilesAndDirectories": "次の {0} ファイル/ディレクトリとその内容を完全に削除しますか?",
"confirmDeleteMessageMultipleDirectories": "次の {0} ディレクトリとその内容を完全に削除しますか?",
"confirmDeleteMessageMultiple": "次の {0} 個のファイルを完全に削除してもよろしいですか?",
"confirmDeleteMessageFolder": "'{0}' とその内容を完全に削除してもよろしいですか?",
"confirmDeleteMessageFile": "'{0}' を完全に削除してもよろしいですか?",
"addFiles": "ファイルを追加",
"confirmOverwrite": "保存先のフォルダーに同じ名前のファイルまたはフォルダーが既に存在します。置き換えてもよろしいですか?",
"replaceButtonLabel": "置換(&&R)",
"fileIsAncestor": "ペーストするファイルは送り先フォルダの上位にいます",
"fileDeleted": "ファイルは削除されたか移動されています",
"duplicateFile": "重複",
"globalCompareFile": "アクティブ ファイルを比較しています...",
"openFileToCompare": "まずファイルを開いてから別のファイルと比較してください",
"refresh": "最新の情報に更新",
"saveAllInGroup": "グループ内のすべてを保存する",
"focusOpenEditors": "開いているエディターのビューにフォーカスする",
"focusFilesExplorer": "ファイル エクスプローラーにフォーカスを置く",
"showInExplorer": "アクティブ ファイルをサイド バーに表示",
"openFileToShow": "エクスプローラーでファイルを表示するには、ファイルをまず開く必要があります",
"collapseExplorerFolders": "エクスプローラーのフォルダーを折りたたむ",
"refreshExplorer": "エクスプローラーを最新表示する",
"openFileInNewWindow": "新しいウィンドウでアクティブ ファイルを開く",
"openFileToShowInNewWindow": "まずファイルを開いてから新しいウィンドウで開きます",
"copyPath": "パスのコピー",
"emptyFileNameError": "ファイルまたはフォルダーの名前を指定する必要があります。",
"fileNameStartsWithSlashError": "ファイルまたはフォルダーの名前はスラッシュで始めることができません。",
"fileNameExistsError": "**{0}** というファイルまたはフォルダーはこの場所に既に存在します。別の名前を指定してください。",
"fileUsedAsFolderError": "**{0}** はファイルのため階層構造を持つことはできません。",
"invalidFileNameError": "名前 **{0}** がファイル名またはフォルダー名として無効です。別の名前を指定してください。",
"filePathTooLongError": "名前 **{0}** のパスが長すぎます。名前を短くしてください。",
"compareWithClipboard": "クリップボードとアクティブ ファイルを比較",
"clipboardComparisonLabel": "クリップボード ↔ {0}"
} | i18n/jpn/src/vs/workbench/parts/files/electron-browser/fileActions.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001779895246727392,
0.00016844409401528537,
0.00016357227286789566,
0.00016742406296543777,
0.0000049271443458565045
] |
{
"id": 8,
"code_window": [
"\n",
"\t\tthis.renderValue(element, isSelected, template);\n",
"\n",
"\t\tconst resetButton = new Button(template.valueElement);\n",
"\t\tresetButton.element.title = localize('resetButtonTitle', \"Reset\");\n",
"\t\tresetButton.element.classList.add('setting-reset-button');\n",
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\tconst resetText = localize('resetButtonTitle', \"reset\");\n",
"\t\tresetButton.label = resetText;\n",
"\t\tresetButton.element.title = resetText;\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 431
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"emptyUserSettingsHeader": "將您的設定放置在此以覆寫預設設定。",
"emptyWorkspaceSettingsHeader": "將您的設定放置在此以覆寫使用者設定。",
"emptyFolderSettingsHeader": "將您的資料夾設定放置在此以覆寫工作區設定的資料夾設定。",
"reportSettingsSearchIssue": "回報問題",
"newExtensionLabel": "顯示擴充功能 \"{0}\"",
"editTtile": "編輯",
"replaceDefaultValue": "在設定中取代",
"copyDefaultValue": "複製到設定"
} | i18n/cht/src/vs/workbench/parts/preferences/browser/preferencesRenderers.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017453219334129244,
0.0001717719715088606,
0.00016901174967642874,
0.0001717719715088606,
0.000002760221832431853
] |
{
"id": 9,
"code_window": [
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n",
"\t\t\tbuttonBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonHoverBackground: Color.transparent.toString()\n",
"\t\t});\n",
"\n",
"\t\ttemplate.toDispose.push(resetButton.onDidClick(e => {\n",
"\t\t\tthis._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\tbuttonHoverBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonForeground: editorActiveLinkForeground\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 437
} | /*---------------------------------------------------------------------------------------------
* 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 { Button } from 'vs/base/browser/ui/button/button';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { IAccessibilityProvider, IDataSource, IFilter, IRenderer, ITree } from 'vs/base/parts/tree/browser/tree';
import { localize } from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SettingsTarget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets';
import { ISearchResult, ISetting, ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import URI from 'vs/base/common/uri';
const $ = DOM.$;
export const modifiedItemForeground = registerColor('settings.modifiedItemForeground', {
light: '#019001',
dark: '#73C991',
hc: '#73C991'
}, localize('modifiedItemForeground', "The foreground color for a modified setting."));
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const modifiedItemForegroundColor = theme.getColor(modifiedItemForeground);
if (modifiedItemForegroundColor) {
collector.addRule(`.settings-editor > .settings-body > .settings-tree-container .setting-item.is-configured .setting-item-is-configured-label { color: ${modifiedItemForegroundColor}; }`);
}
});
export interface ITreeItem {
id: string;
}
export enum TreeItemType {
setting,
groupTitle
}
export interface ISettingElement extends ITreeItem {
type: TreeItemType.setting;
parent: ISettingsGroup;
setting: ISetting;
displayCategory: string;
displayLabel: string;
value: any;
isConfigured: boolean;
overriddenScopeList: string[];
description: string;
valueType?: string | string[];
enum?: string[];
}
export interface IGroupElement extends ITreeItem {
type: TreeItemType.groupTitle;
parent: DefaultSettingsEditorModel;
group: ISettingsGroup;
index: number;
}
export type TreeElement = ISettingElement | IGroupElement;
export type TreeElementOrRoot = TreeElement | DefaultSettingsEditorModel | SearchResultModel;
function inspectSetting(key: string, target: SettingsTarget, configurationService: IConfigurationService): { isConfigured: boolean, inspected: any, targetSelector: string } {
const inspectOverrides = URI.isUri(target) ? { resource: target } : undefined;
const inspected = configurationService.inspect(key, inspectOverrides);
const targetSelector = target === ConfigurationTarget.USER ? 'user' :
target === ConfigurationTarget.WORKSPACE ? 'workspace' :
'workspaceFolder';
const isConfigured = typeof inspected[targetSelector] !== 'undefined';
return { isConfigured, inspected, targetSelector };
}
export class SettingsDataSource implements IDataSource {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
getGroupElement(group: ISettingsGroup, index: number): IGroupElement {
return <IGroupElement>{
type: TreeItemType.groupTitle,
group,
id: `${group.title}_${group.id}`,
index
};
}
getSettingElement(setting: ISetting, group: ISettingsGroup): ISettingElement {
const { isConfigured, inspected, targetSelector } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
const displayValue = isConfigured ? inspected[targetSelector] : inspected.default;
const overriddenScopeList = [];
if (targetSelector === 'user' && typeof inspected.workspace !== 'undefined') {
overriddenScopeList.push(localize('workspace', "Workspace"));
}
if (targetSelector === 'workspace' && typeof inspected.user !== 'undefined') {
overriddenScopeList.push(localize('user', "User"));
}
const displayKeyFormat = settingKeyToDisplayFormat(setting.key);
return <ISettingElement>{
type: TreeItemType.setting,
parent: group,
id: `${group.id}_${setting.key}`,
setting,
displayLabel: displayKeyFormat.label,
displayCategory: displayKeyFormat.category,
isExpanded: false,
value: displayValue,
isConfigured,
overriddenScopeList,
description: setting.description.join('\n'),
enum: setting.enum,
valueType: setting.type
};
}
getId(tree: ITree, element: TreeElementOrRoot): string {
return element instanceof DefaultSettingsEditorModel ? 'root' : element.id;
}
hasChildren(tree: ITree, element: TreeElementOrRoot): boolean {
if (element instanceof DefaultSettingsEditorModel) {
return true;
}
if (element instanceof SearchResultModel) {
return true;
}
if (element.type === TreeItemType.groupTitle) {
return true;
}
return false;
}
_getChildren(element: TreeElementOrRoot): TreeElement[] {
if (element instanceof DefaultSettingsEditorModel) {
return this.getRootChildren(element);
} else if (element instanceof SearchResultModel) {
return this.getGroupChildren(element.resultsAsGroup());
} else if (element.type === TreeItemType.groupTitle) {
return this.getGroupChildren(element.group);
} else {
// No children...
return null;
}
}
getChildren(tree: ITree, element: TreeElementOrRoot): TPromise<any, any> {
return TPromise.as(this._getChildren(element));
}
private getRootChildren(root: DefaultSettingsEditorModel): TreeElement[] {
return root.settingsGroups
.map((g, i) => this.getGroupElement(g, i));
}
private getGroupChildren(group: ISettingsGroup): ISettingElement[] {
const entries: ISettingElement[] = [];
for (const section of group.sections) {
for (const setting of section.settings) {
entries.push(this.getSettingElement(setting, group));
}
}
return entries;
}
getParent(tree: ITree, element: TreeElement): TPromise<any, any> {
if (!element) {
return null;
}
if (!(element instanceof DefaultSettingsEditorModel)) {
return TPromise.wrap(element.parent);
}
return TPromise.wrap(null);
}
}
export function settingKeyToDisplayFormat(key: string): { category: string, label: string } {
let label = key
.replace(/\.([a-z])/g, (match, p1) => `.${p1.toUpperCase()}`)
.replace(/([a-z])([A-Z])/g, '$1 $2') // fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()); // foo => Foo
const lastDotIdx = label.lastIndexOf('.');
let category = '';
if (lastDotIdx >= 0) {
category = label.substr(0, lastDotIdx);
label = label.substr(lastDotIdx + 1);
}
return { category, label };
}
export interface ISettingsEditorViewState {
settingsTarget: SettingsTarget;
showConfiguredOnly?: boolean;
}
export interface IDisposableTemplate {
toDispose: IDisposable[];
}
export interface ISettingItemTemplate extends IDisposableTemplate {
parent: HTMLElement;
context?: ISettingElement;
containerElement: HTMLElement;
categoryElement: HTMLElement;
labelElement: HTMLElement;
descriptionElement: HTMLElement;
expandIndicatorElement: HTMLElement;
valueElement: HTMLElement;
isConfiguredElement: HTMLElement;
otherOverridesElement: HTMLElement;
}
export interface IGroupTitleTemplate extends IDisposableTemplate {
context?: IGroupElement;
parent: HTMLElement;
labelElement: HTMLElement;
}
const SETTINGS_ELEMENT_TEMPLATE_ID = 'settings.entry.template';
const SETTINGS_GROUP_ELEMENT_TEMPLATE_ID = 'settings.group.template';
export interface ISettingChangeEvent {
key: string;
value: any; // undefined => reset/unconfigure
}
export class SettingsRenderer implements IRenderer {
private static readonly SETTING_ROW_HEIGHT = 75;
private readonly _onDidChangeSetting: Emitter<ISettingChangeEvent> = new Emitter<ISettingChangeEvent>();
public readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
private readonly _onDidOpenSettings: Emitter<void> = new Emitter<void>();
public readonly onDidOpenSettings: Event<void> = this._onDidOpenSettings.event;
private measureContainer: HTMLElement;
constructor(
_measureContainer: HTMLElement,
@IThemeService private themeService: IThemeService,
@IContextViewService private contextViewService: IContextViewService
) {
this.measureContainer = DOM.append(_measureContainer, $('.setting-measure-container.monaco-tree-row'));
}
getHeight(tree: ITree, element: TreeElement): number {
if (element.type === TreeItemType.groupTitle) {
return 30;
}
if (element.type === TreeItemType.setting) {
const isSelected = this.elementIsSelected(tree, element);
if (isSelected) {
return this.measureSettingElementHeight(tree, element);
} else {
return SettingsRenderer.SETTING_ROW_HEIGHT;
}
}
return 0;
}
private measureSettingElementHeight(tree: ITree, element: ISettingElement): number {
const measureHelper = DOM.append(this.measureContainer, $('.setting-measure-helper'));
const template = this.renderSettingTemplate(measureHelper);
this.renderSettingElement(tree, element, template, true);
const height = measureHelper.offsetHeight;
this.measureContainer.removeChild(measureHelper);
return height;
}
getTemplateId(tree: ITree, element: TreeElement): string {
if (element.type === TreeItemType.groupTitle) {
return SETTINGS_GROUP_ELEMENT_TEMPLATE_ID;
}
if (element.type === TreeItemType.setting) {
return SETTINGS_ELEMENT_TEMPLATE_ID;
}
return '';
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
return this.renderGroupTitleTemplate(container);
}
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingTemplate(container);
}
return null;
}
private renderGroupTitleTemplate(container: HTMLElement): IGroupTitleTemplate {
DOM.addClass(container, 'group-title');
const labelElement = DOM.append(container, $('h3.settings-group-title-label'));
const toDispose = [];
const template: IGroupTitleTemplate = {
parent: container,
labelElement,
toDispose
};
return template;
}
private renderSettingTemplate(container: HTMLElement): ISettingItemTemplate {
DOM.addClass(container, 'setting-item');
const leftElement = DOM.append(container, $('.setting-item-left'));
const rightElement = DOM.append(container, $('.setting-item-right'));
const titleElement = DOM.append(leftElement, $('.setting-item-title'));
const categoryElement = DOM.append(titleElement, $('span.setting-item-category'));
const labelElement = DOM.append(titleElement, $('span.setting-item-label'));
const isConfiguredElement = DOM.append(titleElement, $('span.setting-item-is-configured-label'));
const otherOverridesElement = DOM.append(titleElement, $('span.setting-item-overrides'));
const descriptionElement = DOM.append(leftElement, $('.setting-item-description'));
const expandIndicatorElement = DOM.append(leftElement, $('.expand-indicator'));
const valueElement = DOM.append(rightElement, $('.setting-item-value'));
const toDispose = [];
const template: ISettingItemTemplate = {
parent: container,
toDispose,
containerElement: container,
categoryElement,
labelElement,
descriptionElement,
expandIndicatorElement,
valueElement,
isConfiguredElement,
otherOverridesElement
};
// Prevent clicks from being handled by list
toDispose.push(DOM.addDisposableListener(valueElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
return template;
}
renderElement(tree: ITree, element: TreeElement, templateId: string, template: any): void {
if (templateId === SETTINGS_ELEMENT_TEMPLATE_ID) {
return this.renderSettingElement(tree, <ISettingElement>element, template);
}
if (templateId === SETTINGS_GROUP_ELEMENT_TEMPLATE_ID) {
(<IGroupTitleTemplate>template).labelElement.textContent = (<IGroupElement>element).group.title;
return;
}
}
private elementIsSelected(tree: ITree, element: TreeElement): boolean {
const selection = tree.getSelection();
const selectedElement: TreeElement = selection && selection[0];
return selectedElement && selectedElement.id === element.id;
}
private renderSettingElement(tree: ITree, element: ISettingElement, template: ISettingItemTemplate, measuring?: boolean): void {
const isSelected = !!this.elementIsSelected(tree, element);
const setting = element.setting;
template.context = element;
DOM.toggleClass(template.parent, 'is-configured', element.isConfigured);
DOM.toggleClass(template.parent, 'is-expanded', isSelected);
template.containerElement.id = element.id;
const titleTooltip = setting.key;
template.categoryElement.textContent = element.displayCategory + ': ';
template.categoryElement.title = titleTooltip;
template.labelElement.textContent = element.displayLabel;
template.labelElement.title = titleTooltip;
template.descriptionElement.textContent = element.description;
if (!measuring) {
const expandedHeight = this.measureSettingElementHeight(tree, element);
const isExpandable = expandedHeight > SettingsRenderer.SETTING_ROW_HEIGHT;
DOM.toggleClass(template.parent, 'is-expandable', isExpandable);
if (isSelected) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-up)');
} else if (isExpandable) {
template.expandIndicatorElement.innerHTML = renderOcticons('$(chevron-down)');
} else {
template.expandIndicatorElement.innerHTML = '';
}
}
this.renderValue(element, isSelected, template);
const resetButton = new Button(template.valueElement);
resetButton.element.title = localize('resetButtonTitle', "Reset");
resetButton.element.classList.add('setting-reset-button');
resetButton.element.tabIndex = isSelected ? 0 : -1;
attachButtonStyler(resetButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString()
});
template.toDispose.push(resetButton.onDidClick(e => {
this._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });
}));
template.toDispose.push(resetButton);
template.isConfiguredElement.textContent = element.isConfigured ? localize('configured', "Modified") : '';
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?
localize('alsoConfiguredIn', "Also modified in") :
localize('configuredIn', "Modified in");
template.otherOverridesElement.textContent = `(${otherOverridesLabel}: ${element.overriddenScopeList.join(', ')})`;
}
}
private renderValue(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const onChange = value => this._onDidChangeSetting.fire({ key: element.setting.key, value });
template.valueElement.innerHTML = '';
if (element.valueType === 'string' && element.enum) {
this.renderEnum(element, isSelected, template, onChange);
} else if (element.valueType === 'boolean') {
this.renderBool(element, isSelected, template, onChange);
} else if (element.valueType === 'string') {
this.renderText(element, isSelected, template, onChange);
} else if (element.valueType === 'number') {
this.renderText(element, isSelected, template, value => onChange(parseInt(value)));
} else {
this.renderEditInSettingsJson(element, isSelected, template);
}
}
private renderBool(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: boolean) => void): void {
const checkboxElement = <HTMLInputElement>DOM.append(template.valueElement, $('input.setting-value-checkbox.setting-value-input'));
checkboxElement.type = 'checkbox';
checkboxElement.checked = element.value;
checkboxElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(DOM.addDisposableListener(checkboxElement, 'change', e => onChange(checkboxElement.checked)));
}
private renderEnum(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const idx = element.enum.indexOf(element.value);
const selectBox = new SelectBox(element.enum, idx, this.contextViewService);
template.toDispose.push(selectBox);
template.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
selectBox.render(template.valueElement);
if (template.valueElement.firstElementChild) {
template.valueElement.firstElementChild.setAttribute('tabindex', isSelected ? '0' : '-1');
}
template.toDispose.push(
selectBox.onDidSelect(e => onChange(element.enum[e.index])));
}
private renderText(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate, onChange: (value: string) => void): void {
const inputBox = new InputBox(template.valueElement, this.contextViewService);
template.toDispose.push(attachInputBoxStyler(inputBox, this.themeService));
template.toDispose.push(inputBox);
inputBox.value = element.value;
inputBox.inputElement.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(
inputBox.onDidChange(e => onChange(e)));
}
private renderEditInSettingsJson(element: ISettingElement, isSelected: boolean, template: ISettingItemTemplate): void {
const openSettingsButton = new Button(template.valueElement, { title: true, buttonBackground: null, buttonHoverBackground: null });
openSettingsButton.onDidClick(() => this._onDidOpenSettings.fire());
openSettingsButton.label = localize('editInSettingsJson', "Edit in settings.json");
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.tabIndex = isSelected ? 0 : -1;
template.toDispose.push(openSettingsButton);
template.toDispose.push(attachButtonStyler(openSettingsButton, this.themeService, {
buttonBackground: Color.transparent.toString(),
buttonHoverBackground: Color.transparent.toString(),
buttonForeground: 'foreground'
}));
}
disposeTemplate(tree: ITree, templateId: string, template: IDisposableTemplate): void {
dispose(template.toDispose);
}
}
export class SettingsTreeFilter implements IFilter {
constructor(
private viewState: ISettingsEditorViewState,
@IConfigurationService private configurationService: IConfigurationService
) { }
isVisible(tree: ITree, element: TreeElement): boolean {
if (this.viewState.showConfiguredOnly && element.type === TreeItemType.setting) {
return element.isConfigured;
}
if (element.type === TreeItemType.groupTitle && this.viewState.showConfiguredOnly) {
return this.groupHasConfiguredSetting(element.group);
}
return true;
}
private groupHasConfiguredSetting(group: ISettingsGroup): boolean {
for (let section of group.sections) {
for (let setting of section.settings) {
const { isConfigured } = inspectSetting(setting.key, this.viewState.settingsTarget, this.configurationService);
if (isConfigured) {
return true;
}
}
}
return false;
}
}
export class SettingsTreeController extends WorkbenchTreeController {
constructor(
@IConfigurationService configurationService: IConfigurationService
) {
super({}, configurationService);
}
}
export class SettingsAccessibilityProvider implements IAccessibilityProvider {
getAriaLabel(tree: ITree, element: TreeElement): string {
if (!element) {
return '';
}
if (element.type === TreeItemType.setting) {
return localize('settingRowAriaLabel', "{0} {1}, Setting", element.displayCategory, element.displayLabel);
}
if (element.type === TreeItemType.groupTitle) {
return localize('groupRowAriaLabel', "{0}, group", element.group.title);
}
return '';
}
}
export enum SearchResultIdx {
Local = 0,
Remote = 1
}
export class SearchResultModel {
private rawSearchResults: ISearchResult[];
private cachedUniqueSearchResults: ISearchResult[];
readonly id = 'searchResultModel';
getUniqueResults(): ISearchResult[] {
if (this.cachedUniqueSearchResults) {
return this.cachedUniqueSearchResults;
}
if (!this.rawSearchResults) {
return [];
}
const localMatchKeys = new Set();
const localResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Local]);
if (localResult) {
localResult.filterMatches.forEach(m => localMatchKeys.add(m.setting.key));
}
const remoteResult = objects.deepClone(this.rawSearchResults[SearchResultIdx.Remote]);
if (remoteResult) {
remoteResult.filterMatches = remoteResult.filterMatches.filter(m => !localMatchKeys.has(m.setting.key));
}
this.cachedUniqueSearchResults = [localResult, remoteResult];
return this.cachedUniqueSearchResults;
}
getRawResults(): ISearchResult[] {
return this.rawSearchResults;
}
setResult(type: SearchResultIdx, result: ISearchResult): void {
this.cachedUniqueSearchResults = null;
this.rawSearchResults = this.rawSearchResults || [];
this.rawSearchResults[type] = result;
}
resultsAsGroup(): ISettingsGroup {
const flatSettings: ISetting[] = [];
this.getUniqueResults()
.filter(r => !!r)
.forEach(r => {
flatSettings.push(
...r.filterMatches.map(m => m.setting));
});
return <ISettingsGroup>{
id: 'settingsSearchResultGroup',
range: null,
sections: [
{ settings: flatSettings }
],
title: 'searchResults',
titleRange: null
};
}
}
| src/vs/workbench/parts/preferences/browser/settingsTree.ts | 1 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.9966011047363281,
0.017025424167513847,
0.00015956236165948212,
0.00018923792231362313,
0.12263044714927673
] |
{
"id": 9,
"code_window": [
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n",
"\t\t\tbuttonBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonHoverBackground: Color.transparent.toString()\n",
"\t\t});\n",
"\n",
"\t\ttemplate.toDispose.push(resetButton.onDidClick(e => {\n",
"\t\t\tthis._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\tbuttonHoverBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonForeground: editorActiveLinkForeground\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 437
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"terminal.integrated.allowWorkspaceShell": "터미널에서 {0}(작업 영역 설정으로 정의됨)이(가) 시작되도록\n 허용할까요?",
"allow": "Allow",
"disallow": "Disallow"
} | i18n/kor/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.00017521115660201758,
0.00017185624164994806,
0.00016850132669787854,
0.00017185624164994806,
0.000003354914952069521
] |
{
"id": 9,
"code_window": [
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n",
"\t\t\tbuttonBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonHoverBackground: Color.transparent.toString()\n",
"\t\t});\n",
"\n",
"\t\ttemplate.toDispose.push(resetButton.onDidClick(e => {\n",
"\t\t\tthis._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\tbuttonHoverBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonForeground: editorActiveLinkForeground\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 437
} | {
"": [
"--------------------------------------------------------------------------------------------",
"Copyright (c) Microsoft Corporation. All rights reserved.",
"Licensed under the MIT License. See License.txt in the project root for license information.",
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"extensionHostProcess.startupFailDebug": "L'host dell'estensione non è stato avviato entro 10 secondi. Potrebbe essersi arrestato alla prima riga e richiedere un debugger per continuare.",
"extensionHostProcess.startupFail": "L'host dell'estensione non è stato avviato entro 10 secondi. Potrebbe essersi verificato un problema.",
"reloadWindow": "Ricarica finestra",
"extensionHostProcess.error": "Errore restituito dall'host dell'estensione: {0}"
} | i18n/ita/src/vs/workbench/services/extensions/electron-browser/extensionHost.i18n.json | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001750239753164351,
0.00017232784011866897,
0.00016963170492090285,
0.00017232784011866897,
0.000002696135197766125
] |
{
"id": 9,
"code_window": [
"\t\tresetButton.element.tabIndex = isSelected ? 0 : -1;\n",
"\n",
"\t\tattachButtonStyler(resetButton, this.themeService, {\n",
"\t\t\tbuttonBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonHoverBackground: Color.transparent.toString()\n",
"\t\t});\n",
"\n",
"\t\ttemplate.toDispose.push(resetButton.onDidClick(e => {\n",
"\t\t\tthis._onDidChangeSetting.fire({ key: element.setting.key, value: undefined });\n"
],
"labels": [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"\t\t\tbuttonHoverBackground: Color.transparent.toString(),\n",
"\t\t\tbuttonForeground: editorActiveLinkForeground\n"
],
"file_path": "src/vs/workbench/parts/preferences/browser/settingsTree.ts",
"type": "replace",
"edit_start_line_idx": 437
} | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import { ILink } from 'vs/editor/common/modes';
import { ILinkComputerTarget, computeLinks } from 'vs/editor/common/modes/linkComputer';
class SimpleLinkComputerTarget implements ILinkComputerTarget {
constructor(private _lines: string[]) {
// Intentional Empty
}
public getLineCount(): number {
return this._lines.length;
}
public getLineContent(lineNumber: number): string {
return this._lines[lineNumber - 1];
}
}
function myComputeLinks(lines: string[]): ILink[] {
let target = new SimpleLinkComputerTarget(lines);
return computeLinks(target);
}
function assertLink(text: string, extractedLink: string): void {
let startColumn = 0,
endColumn = 0,
chr: string,
i = 0;
for (i = 0; i < extractedLink.length; i++) {
chr = extractedLink.charAt(i);
if (chr !== ' ' && chr !== '\t') {
startColumn = i + 1;
break;
}
}
for (i = extractedLink.length - 1; i >= 0; i--) {
chr = extractedLink.charAt(i);
if (chr !== ' ' && chr !== '\t') {
endColumn = i + 2;
break;
}
}
let r = myComputeLinks([text]);
assert.deepEqual(r, [{
range: {
startLineNumber: 1,
startColumn: startColumn,
endLineNumber: 1,
endColumn: endColumn
},
url: extractedLink.substring(startColumn - 1, endColumn - 1)
}]);
}
suite('Editor Modes - Link Computer', () => {
test('Null model', () => {
let r = computeLinks(null);
assert.deepEqual(r, []);
});
test('Parsing', () => {
assertLink(
'x = "http://foo.bar";',
' http://foo.bar '
);
assertLink(
'x = (http://foo.bar);',
' http://foo.bar '
);
assertLink(
'x = [http://foo.bar];',
' http://foo.bar '
);
assertLink(
'x = \'http://foo.bar\';',
' http://foo.bar '
);
assertLink(
'x = http://foo.bar ;',
' http://foo.bar '
);
assertLink(
'x = <http://foo.bar>;',
' http://foo.bar '
);
assertLink(
'x = {http://foo.bar};',
' http://foo.bar '
);
assertLink(
'(see http://foo.bar)',
' http://foo.bar '
);
assertLink(
'[see http://foo.bar]',
' http://foo.bar '
);
assertLink(
'{see http://foo.bar}',
' http://foo.bar '
);
assertLink(
'<see http://foo.bar>',
' http://foo.bar '
);
assertLink(
'<url>http://mylink.com</url>',
' http://mylink.com '
);
assertLink(
'// Click here to learn more. https://go.microsoft.com/fwlink/?LinkID=513275&clcid=0x409',
' https://go.microsoft.com/fwlink/?LinkID=513275&clcid=0x409'
);
assertLink(
'// Click here to learn more. https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx',
' https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx'
);
assertLink(
'// https://github.com/projectkudu/kudu/blob/master/Kudu.Core/Scripts/selectNodeVersion.js',
' https://github.com/projectkudu/kudu/blob/master/Kudu.Core/Scripts/selectNodeVersion.js'
);
assertLink(
'<!-- !!! Do not remove !!! WebContentRef(link:https://go.microsoft.com/fwlink/?LinkId=166007, area:Admin, updated:2015, nextUpdate:2016, tags:SqlServer) !!! Do not remove !!! -->',
' https://go.microsoft.com/fwlink/?LinkId=166007 '
);
assertLink(
'For instructions, see https://go.microsoft.com/fwlink/?LinkId=166007.</value>',
' https://go.microsoft.com/fwlink/?LinkId=166007 '
);
assertLink(
'For instructions, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx.</value>',
' https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx '
);
assertLink(
'x = "https://en.wikipedia.org/wiki/Zürich";',
' https://en.wikipedia.org/wiki/Zürich '
);
assertLink(
'請參閱 http://go.microsoft.com/fwlink/?LinkId=761051。',
' http://go.microsoft.com/fwlink/?LinkId=761051 '
);
assertLink(
'(請參閱 http://go.microsoft.com/fwlink/?LinkId=761051)',
' http://go.microsoft.com/fwlink/?LinkId=761051 '
);
assertLink(
'x = "file:///foo.bar";',
' file:///foo.bar '
);
assertLink(
'x = "file://c:/foo.bar";',
' file://c:/foo.bar '
);
assertLink(
'x = "file://shares/foo.bar";',
' file://shares/foo.bar '
);
assertLink(
'x = "file://shäres/foo.bar";',
' file://shäres/foo.bar '
);
assertLink(
'Some text, then http://www.bing.com.',
' http://www.bing.com '
);
assertLink(
'let url = `http://***/_api/web/lists/GetByTitle(\'Teambuildingaanvragen\')/items`;',
' http://***/_api/web/lists/GetByTitle(\'Teambuildingaanvragen\')/items '
);
});
test('issue #7855', () => {
assertLink(
'7. At this point, ServiceMain has been called. There is no functionality presently in ServiceMain, but you can consult the [MSDN documentation](https://msdn.microsoft.com/en-us/library/windows/desktop/ms687414(v=vs.85).aspx) to add functionality as desired!',
' https://msdn.microsoft.com/en-us/library/windows/desktop/ms687414(v=vs.85).aspx '
);
});
});
| src/vs/editor/test/common/modes/linkComputer.test.ts | 0 | https://github.com/microsoft/vscode/commit/c054cbaf56d0a355fc2d93b8a91ed2bbf798d0e4 | [
0.0001759660808602348,
0.00017234301776625216,
0.00016764075553510338,
0.00017296891019213945,
0.000002027734126386349
] |
{
"id": 0,
"code_window": [
" value: any;\n",
" className?: string;\n",
" children: ReactNode;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" title?: string;\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "add",
"edit_start_line_idx": 51
} | import _ from 'lodash';
import React, { PureComponent } from 'react';
import Highlighter from 'react-highlight-words';
import classnames from 'classnames';
import * as rangeUtil from 'app/core/utils/rangeutil';
import { RawTimeRange } from 'app/types/series';
import {
LogsDedupStrategy,
LogsModel,
dedupLogRows,
filterLogLevels,
getParser,
LogLevel,
LogsMetaKind,
LogsLabelStat,
LogsParser,
LogRow,
calculateFieldStats,
} from 'app/core/logs_model';
import { findHighlightChunksInText } from 'app/core/utils/text';
import { Switch } from 'app/core/components/Switch/Switch';
import ToggleButtonGroup, { ToggleButton } from 'app/core/components/ToggleButtonGroup/ToggleButtonGroup';
import Graph from './Graph';
import LogLabels, { Stats } from './LogLabels';
const PREVIEW_LIMIT = 100;
const graphOptions = {
series: {
stack: true,
bars: {
show: true,
lineWidth: 5,
// barWidth: 10,
},
// stack: true,
},
yaxis: {
tickDecimals: 0,
},
};
/**
* Renders a highlighted field.
* When hovering, a stats icon is shown.
*/
const FieldHighlight = onClick => props => {
return (
<span className={props.className} style={props.style}>
{props.children}
<span className="logs-row__field-highlight--icon fa fa-signal" onClick={() => onClick(props.children)} />
</span>
);
};
interface RowProps {
allRows: LogRow[];
highlighterExpressions?: string[];
row: LogRow;
showDuplicates: boolean;
showLabels: boolean | null; // Tristate: null means auto
showLocalTime: boolean;
showUtc: boolean;
onClickLabel?: (label: string, value: string) => void;
}
interface RowState {
fieldCount: number;
fieldLabel: string;
fieldStats: LogsLabelStat[];
fieldValue: string;
parsed: boolean;
parser: LogsParser;
parsedFieldHighlights: string[];
showFieldStats: boolean;
}
/**
* Renders a log line.
*
* When user hovers over it for a certain time, it lazily parses the log line.
* Once a parser is found, it will determine fields, that will be highlighted.
* When the user requests stats for a field, they will be calculated and rendered below the row.
*/
class Row extends PureComponent<RowProps, RowState> {
mouseMessageTimer: NodeJS.Timer;
state = {
fieldCount: 0,
fieldLabel: null,
fieldStats: null,
fieldValue: null,
parsed: false,
parser: null,
parsedFieldHighlights: [],
showFieldStats: false,
};
componentWillUnmount() {
clearTimeout(this.mouseMessageTimer);
}
onClickClose = () => {
this.setState({ showFieldStats: false });
};
onClickHighlight = (fieldText: string) => {
const { allRows } = this.props;
const { parser } = this.state;
const fieldMatch = fieldText.match(parser.fieldRegex);
if (fieldMatch) {
// Build value-agnostic row matcher based on the field label
const fieldLabel = fieldMatch[1];
const fieldValue = fieldMatch[2];
const matcher = parser.buildMatcher(fieldLabel);
const fieldStats = calculateFieldStats(allRows, matcher);
const fieldCount = fieldStats.reduce((sum, stat) => sum + stat.count, 0);
this.setState({ fieldCount, fieldLabel, fieldStats, fieldValue, showFieldStats: true });
}
};
onMouseOverMessage = () => {
// Don't parse right away, user might move along
this.mouseMessageTimer = setTimeout(this.parseMessage, 500);
};
onMouseOutMessage = () => {
clearTimeout(this.mouseMessageTimer);
this.setState({ parsed: false });
};
parseMessage = () => {
if (!this.state.parsed) {
const { row } = this.props;
const parser = getParser(row.entry);
if (parser) {
// Use parser to highlight detected fields
const parsedFieldHighlights = [];
this.props.row.entry.replace(new RegExp(parser.fieldRegex, 'g'), substring => {
parsedFieldHighlights.push(substring.trim());
return '';
});
this.setState({ parsedFieldHighlights, parsed: true, parser });
}
}
};
render() {
const {
allRows,
highlighterExpressions,
onClickLabel,
row,
showDuplicates,
showLabels,
showLocalTime,
showUtc,
} = this.props;
const {
fieldCount,
fieldLabel,
fieldStats,
fieldValue,
parsed,
parsedFieldHighlights,
showFieldStats,
} = this.state;
const previewHighlights = highlighterExpressions && !_.isEqual(highlighterExpressions, row.searchWords);
const highlights = previewHighlights ? highlighterExpressions : row.searchWords;
const needsHighlighter = highlights && highlights.length > 0;
const highlightClassName = classnames('logs-row__match-highlight', {
'logs-row__match-highlight--preview': previewHighlights,
});
return (
<div className="logs-row">
{showDuplicates && (
<div className="logs-row__duplicates">{row.duplicates > 0 ? `${row.duplicates + 1}x` : null}</div>
)}
<div className={row.logLevel ? `logs-row__level logs-row__level--${row.logLevel}` : ''} />
{showUtc && (
<div className="logs-row__time" title={`Local: ${row.timeLocal} (${row.timeFromNow})`}>
{row.timestamp}
</div>
)}
{showLocalTime && (
<div className="logs-row__time" title={`${row.timestamp} (${row.timeFromNow})`}>
{row.timeLocal}
</div>
)}
{showLabels && (
<div className="logs-row__labels">
<LogLabels allRows={allRows} labels={row.uniqueLabels} onClickLabel={onClickLabel} />
</div>
)}
<div className="logs-row__message" onMouseEnter={this.onMouseOverMessage} onMouseLeave={this.onMouseOutMessage}>
{parsed && (
<Highlighter
autoEscape
highlightTag={FieldHighlight(this.onClickHighlight)}
textToHighlight={row.entry}
searchWords={parsedFieldHighlights}
highlightClassName="logs-row__field-highlight"
/>
)}
{!parsed &&
needsHighlighter && (
<Highlighter
textToHighlight={row.entry}
searchWords={highlights}
findChunks={findHighlightChunksInText}
highlightClassName={highlightClassName}
/>
)}
{!parsed && !needsHighlighter && row.entry}
{showFieldStats && (
<div className="logs-row__stats">
<Stats
stats={fieldStats}
label={fieldLabel}
value={fieldValue}
onClickClose={this.onClickClose}
rowCount={fieldCount}
/>
</div>
)}
</div>
</div>
);
}
}
function renderMetaItem(value: any, kind: LogsMetaKind) {
if (kind === LogsMetaKind.LabelsMap) {
return (
<span className="logs-meta-item__labels">
<LogLabels labels={value} plain />
</span>
);
}
return value;
}
interface LogsProps {
data: LogsModel;
highlighterExpressions: string[];
loading: boolean;
position: string;
range?: RawTimeRange;
scanning?: boolean;
scanRange?: RawTimeRange;
onChangeTime?: (range: RawTimeRange) => void;
onClickLabel?: (label: string, value: string) => void;
onStartScanning?: () => void;
onStopScanning?: () => void;
}
interface LogsState {
dedup: LogsDedupStrategy;
deferLogs: boolean;
hiddenLogLevels: Set<LogLevel>;
renderAll: boolean;
showLabels: boolean | null; // Tristate: null means auto
showLocalTime: boolean;
showUtc: boolean;
}
export default class Logs extends PureComponent<LogsProps, LogsState> {
deferLogsTimer: NodeJS.Timer;
renderAllTimer: NodeJS.Timer;
state = {
dedup: LogsDedupStrategy.none,
deferLogs: true,
hiddenLogLevels: new Set(),
renderAll: false,
showLabels: null,
showLocalTime: true,
showUtc: false,
};
componentDidMount() {
// Staged rendering
if (this.state.deferLogs) {
const { data } = this.props;
const rowCount = data && data.rows ? data.rows.length : 0;
// Render all right away if not too far over the limit
const renderAll = rowCount <= PREVIEW_LIMIT * 2;
this.deferLogsTimer = setTimeout(() => this.setState({ deferLogs: false, renderAll }), rowCount);
}
}
componentDidUpdate(prevProps, prevState) {
// Staged rendering
if (prevState.deferLogs && !this.state.deferLogs && !this.state.renderAll) {
this.renderAllTimer = setTimeout(() => this.setState({ renderAll: true }), 2000);
}
}
componentWillUnmount() {
clearTimeout(this.deferLogsTimer);
clearTimeout(this.renderAllTimer);
}
onChangeDedup = (dedup: LogsDedupStrategy) => {
this.setState(prevState => {
if (prevState.dedup === dedup) {
return { dedup: LogsDedupStrategy.none };
}
return { dedup };
});
};
onChangeLabels = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showLabels: target.checked,
});
};
onChangeLocalTime = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showLocalTime: target.checked,
});
};
onChangeUtc = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showUtc: target.checked,
});
};
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: Set<string>) => {
const hiddenLogLevels: Set<LogLevel> = new Set(Array.from(hiddenRawLevels).map(level => LogLevel[level]));
this.setState({ hiddenLogLevels });
};
onClickScan = (event: React.SyntheticEvent) => {
event.preventDefault();
this.props.onStartScanning();
};
onClickStopScan = (event: React.SyntheticEvent) => {
event.preventDefault();
this.props.onStopScanning();
};
render() {
const {
data,
highlighterExpressions,
loading = false,
onClickLabel,
position,
range,
scanning,
scanRange,
} = this.props;
const { dedup, deferLogs, hiddenLogLevels, renderAll, showLocalTime, showUtc } = this.state;
let { showLabels } = this.state;
const hasData = data && data.rows && data.rows.length > 0;
const showDuplicates = dedup !== LogsDedupStrategy.none;
// Filtering
const filteredData = filterLogLevels(data, hiddenLogLevels);
const dedupedData = dedupLogRows(filteredData, dedup);
const dedupCount = dedupedData.rows.reduce((sum, row) => sum + row.duplicates, 0);
const meta = [...data.meta];
if (dedup !== LogsDedupStrategy.none) {
meta.push({
label: 'Dedup count',
value: dedupCount,
kind: LogsMetaKind.Number,
});
}
// Staged rendering
const processedRows = dedupedData.rows;
const firstRows = processedRows.slice(0, PREVIEW_LIMIT);
const lastRows = processedRows.slice(PREVIEW_LIMIT);
// Check for labels
if (showLabels === null) {
if (hasData) {
showLabels = data.rows.some(row => _.size(row.uniqueLabels) > 0);
} else {
showLabels = true;
}
}
// Grid options
// const cssColumnSizes = [];
// if (showDuplicates) {
// cssColumnSizes.push('max-content');
// }
// // Log-level indicator line
// cssColumnSizes.push('3px');
// if (showUtc) {
// cssColumnSizes.push('minmax(220px, max-content)');
// }
// if (showLocalTime) {
// cssColumnSizes.push('minmax(140px, max-content)');
// }
// if (showLabels) {
// cssColumnSizes.push('fit-content(20%)');
// }
// cssColumnSizes.push('1fr');
// const logEntriesStyle = {
// gridTemplateColumns: cssColumnSizes.join(' '),
// };
const scanText = scanRange ? `Scanning ${rangeUtil.describeTimeRange(scanRange)}` : 'Scanning...';
return (
<div className="logs-panel">
<div className="logs-panel-graph">
<Graph
data={data.series}
height="100px"
range={range}
id={`explore-logs-graph-${position}`}
onChangeTime={this.props.onChangeTime}
onToggleSeries={this.onToggleLogLevel}
userOptions={graphOptions}
/>
</div>
<div className="logs-panel-options">
<div className="logs-panel-controls">
<Switch label="Timestamp" checked={showUtc} onChange={this.onChangeUtc} small />
<Switch label="Local time" checked={showLocalTime} onChange={this.onChangeLocalTime} small />
<Switch label="Labels" checked={showLabels} onChange={this.onChangeLabels} small />
<ToggleButtonGroup
label="Dedup"
onChange={this.onChangeDedup}
value={dedup}
render={({ selectedValue, onChange }) =>
Object.keys(LogsDedupStrategy).map((dedupType, i) => (
<ToggleButton
className="btn-small"
key={i}
value={dedupType}
onChange={onChange}
selected={selectedValue === dedupType}
>
{dedupType}
</ToggleButton>
))
}
/>
{hasData &&
meta && (
<div className="logs-panel-meta">
{meta.map(item => (
<div className="logs-panel-meta__item" key={item.label}>
<span className="logs-panel-meta__label">{item.label}:</span>
<span className="logs-panel-meta__value">{renderMetaItem(item.value, item.kind)}</span>
</div>
))}
</div>
)}
</div>
</div>
<div className="logs-rows">
{hasData &&
!deferLogs &&
// Only inject highlighterExpression in the first set for performance reasons
firstRows.map(row => (
<Row
key={row.key + row.duplicates}
allRows={processedRows}
highlighterExpressions={highlighterExpressions}
row={row}
showDuplicates={showDuplicates}
showLabels={showLabels}
showLocalTime={showLocalTime}
showUtc={showUtc}
onClickLabel={onClickLabel}
/>
))}
{hasData &&
!deferLogs &&
renderAll &&
lastRows.map(row => (
<Row
key={row.key + row.duplicates}
allRows={processedRows}
row={row}
showDuplicates={showDuplicates}
showLabels={showLabels}
showLocalTime={showLocalTime}
showUtc={showUtc}
onClickLabel={onClickLabel}
/>
))}
{hasData && deferLogs && <span>Rendering {dedupedData.rows.length} rows...</span>}
</div>
{!loading &&
!hasData &&
!scanning && (
<div className="logs-panel-nodata">
No logs found.
<a className="link" onClick={this.onClickScan}>
Scan for older logs
</a>
</div>
)}
{scanning && (
<div className="logs-panel-nodata">
<span>{scanText}</span>
<a className="link" onClick={this.onClickStopScan}>
Stop scan
</a>
</div>
)}
</div>
);
}
}
| public/app/features/explore/Logs.tsx | 1 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.9046958684921265,
0.037061918526887894,
0.00016458405298180878,
0.00017108063912019134,
0.17219161987304688
] |
{
"id": 0,
"code_window": [
" value: any;\n",
" className?: string;\n",
" children: ReactNode;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" title?: string;\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "add",
"edit_start_line_idx": 51
} | package dashboards
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/grafana/grafana/pkg/log"
yaml "gopkg.in/yaml.v2"
)
type configReader struct {
path string
log log.Logger
}
func (cr *configReader) parseConfigs(file os.FileInfo) ([]*DashboardsAsConfig, error) {
filename, _ := filepath.Abs(filepath.Join(cr.path, file.Name()))
yamlFile, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
apiVersion := &ConfigVersion{ApiVersion: 0}
yaml.Unmarshal(yamlFile, &apiVersion)
if apiVersion.ApiVersion > 0 {
v1 := &DashboardAsConfigV1{}
err := yaml.Unmarshal(yamlFile, &v1)
if err != nil {
return nil, err
}
if v1 != nil {
return v1.mapToDashboardAsConfig(), nil
}
} else {
var v0 []*DashboardsAsConfigV0
err := yaml.Unmarshal(yamlFile, &v0)
if err != nil {
return nil, err
}
if v0 != nil {
cr.log.Warn("[Deprecated] the dashboard provisioning config is outdated. please upgrade", "filename", filename)
return mapV0ToDashboardAsConfig(v0), nil
}
}
return []*DashboardsAsConfig{}, nil
}
func (cr *configReader) readConfig() ([]*DashboardsAsConfig, error) {
var dashboards []*DashboardsAsConfig
files, err := ioutil.ReadDir(cr.path)
if err != nil {
cr.log.Error("can't read dashboard provisioning files from directory", "path", cr.path)
return dashboards, nil
}
for _, file := range files {
if !strings.HasSuffix(file.Name(), ".yaml") && !strings.HasSuffix(file.Name(), ".yml") {
continue
}
parsedDashboards, err := cr.parseConfigs(file)
if err != nil {
return nil, err
}
if len(parsedDashboards) > 0 {
dashboards = append(dashboards, parsedDashboards...)
}
}
for i := range dashboards {
if dashboards[i].OrgId == 0 {
dashboards[i].OrgId = 1
}
if dashboards[i].UpdateIntervalSeconds == 0 {
dashboards[i].UpdateIntervalSeconds = 10
}
}
return dashboards, nil
}
| pkg/services/provisioning/dashboards/config_reader.go | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.000185498982318677,
0.00017386881518177688,
0.00016765498730819672,
0.00017344756633974612,
0.000004966650067217415
] |
{
"id": 0,
"code_window": [
" value: any;\n",
" className?: string;\n",
" children: ReactNode;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" title?: string;\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "add",
"edit_start_line_idx": 51
} | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !gccgo
#include "textflag.h"
//
// System call support for 386, OpenBSD
//
// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.
TEXT ·Syscall(SB),NOSPLIT,$0-28
JMP syscall·Syscall(SB)
TEXT ·Syscall6(SB),NOSPLIT,$0-40
JMP syscall·Syscall6(SB)
TEXT ·Syscall9(SB),NOSPLIT,$0-52
JMP syscall·Syscall9(SB)
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
JMP syscall·RawSyscall(SB)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
JMP syscall·RawSyscall6(SB)
| vendor/golang.org/x/sys/unix/asm_openbsd_386.s | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00017961958656087518,
0.00017419784853700548,
0.0001694635720923543,
0.00017351038695778698,
0.000004174574769422179
] |
{
"id": 0,
"code_window": [
" value: any;\n",
" className?: string;\n",
" children: ReactNode;\n",
"}\n",
"\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep"
],
"after_edit": [
" title?: string;\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "add",
"edit_start_line_idx": 51
} | package models
import (
"errors"
"fmt"
"strings"
"time"
"github.com/gosimple/slug"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/setting"
)
// Typed errors
var (
ErrDashboardNotFound = errors.New("Dashboard not found")
ErrDashboardFolderNotFound = errors.New("Folder not found")
ErrDashboardSnapshotNotFound = errors.New("Dashboard snapshot not found")
ErrDashboardWithSameUIDExists = errors.New("A dashboard with the same uid already exists")
ErrDashboardWithSameNameInFolderExists = errors.New("A dashboard with the same name in the folder already exists")
ErrDashboardVersionMismatch = errors.New("The dashboard has been changed by someone else")
ErrDashboardTitleEmpty = errors.New("Dashboard title cannot be empty")
ErrDashboardFolderCannotHaveParent = errors.New("A Dashboard Folder cannot be added to another folder")
ErrDashboardsWithSameSlugExists = errors.New("Multiple dashboards with the same slug exists")
ErrDashboardFailedGenerateUniqueUid = errors.New("Failed to generate unique dashboard id")
ErrDashboardTypeMismatch = errors.New("Dashboard cannot be changed to a folder")
ErrDashboardFolderWithSameNameAsDashboard = errors.New("Folder name cannot be the same as one of its dashboards")
ErrDashboardWithSameNameAsFolder = errors.New("Dashboard name cannot be the same as folder")
ErrDashboardFolderNameExists = errors.New("A folder with that name already exists")
ErrDashboardUpdateAccessDenied = errors.New("Access denied to save dashboard")
ErrDashboardInvalidUid = errors.New("uid contains illegal characters")
ErrDashboardUidToLong = errors.New("uid to long. max 40 characters")
ErrDashboardCannotSaveProvisionedDashboard = errors.New("Cannot save provisioned dashboard")
RootFolderName = "General"
)
type UpdatePluginDashboardError struct {
PluginId string
}
func (d UpdatePluginDashboardError) Error() string {
return "Dashboard belong to plugin"
}
var (
DashTypeJson = "file"
DashTypeDB = "db"
DashTypeScript = "script"
DashTypeSnapshot = "snapshot"
)
// Dashboard model
type Dashboard struct {
Id int64
Uid string
Slug string
OrgId int64
GnetId int64
Version int
PluginId string
Created time.Time
Updated time.Time
UpdatedBy int64
CreatedBy int64
FolderId int64
IsFolder bool
HasAcl bool
Title string
Data *simplejson.Json
}
func (d *Dashboard) SetId(id int64) {
d.Id = id
d.Data.Set("id", id)
}
func (d *Dashboard) SetUid(uid string) {
d.Uid = uid
d.Data.Set("uid", uid)
}
func (d *Dashboard) SetVersion(version int) {
d.Version = version
d.Data.Set("version", version)
}
// GetDashboardIdForSavePermissionCheck return the dashboard id to be used for checking permission of dashboard
func (d *Dashboard) GetDashboardIdForSavePermissionCheck() int64 {
if d.Id == 0 {
return d.FolderId
}
return d.Id
}
// NewDashboard creates a new dashboard
func NewDashboard(title string) *Dashboard {
dash := &Dashboard{}
dash.Data = simplejson.New()
dash.Data.Set("title", title)
dash.Title = title
dash.Created = time.Now()
dash.Updated = time.Now()
dash.UpdateSlug()
return dash
}
// NewDashboardFolder creates a new dashboard folder
func NewDashboardFolder(title string) *Dashboard {
folder := NewDashboard(title)
folder.IsFolder = true
folder.Data.Set("schemaVersion", 16)
folder.Data.Set("version", 0)
folder.IsFolder = true
return folder
}
// GetTags turns the tags in data json into go string array
func (dash *Dashboard) GetTags() []string {
return dash.Data.Get("tags").MustStringArray()
}
func NewDashboardFromJson(data *simplejson.Json) *Dashboard {
dash := &Dashboard{}
dash.Data = data
dash.Title = dash.Data.Get("title").MustString()
dash.UpdateSlug()
update := false
if id, err := dash.Data.Get("id").Float64(); err == nil {
dash.Id = int64(id)
update = true
}
if uid, err := dash.Data.Get("uid").String(); err == nil {
dash.Uid = uid
update = true
}
if version, err := dash.Data.Get("version").Float64(); err == nil && update {
dash.Version = int(version)
dash.Updated = time.Now()
} else {
dash.Data.Set("version", 0)
dash.Created = time.Now()
dash.Updated = time.Now()
}
if gnetId, err := dash.Data.Get("gnetId").Float64(); err == nil {
dash.GnetId = int64(gnetId)
}
return dash
}
// GetDashboardModel turns the command into the saveable model
func (cmd *SaveDashboardCommand) GetDashboardModel() *Dashboard {
dash := NewDashboardFromJson(cmd.Dashboard)
userId := cmd.UserId
if userId == 0 {
userId = -1
}
dash.UpdatedBy = userId
dash.OrgId = cmd.OrgId
dash.PluginId = cmd.PluginId
dash.IsFolder = cmd.IsFolder
dash.FolderId = cmd.FolderId
dash.UpdateSlug()
return dash
}
// GetString a
func (dash *Dashboard) GetString(prop string, defaultValue string) string {
return dash.Data.Get(prop).MustString(defaultValue)
}
// UpdateSlug updates the slug
func (dash *Dashboard) UpdateSlug() {
title := dash.Data.Get("title").MustString()
dash.Slug = SlugifyTitle(title)
}
func SlugifyTitle(title string) string {
return slug.Make(strings.ToLower(title))
}
// GetUrl return the html url for a folder if it's folder, otherwise for a dashboard
func (dash *Dashboard) GetUrl() string {
return GetDashboardFolderUrl(dash.IsFolder, dash.Uid, dash.Slug)
}
// Return the html url for a dashboard
func (dash *Dashboard) GenerateUrl() string {
return GetDashboardUrl(dash.Uid, dash.Slug)
}
// GetDashboardFolderUrl return the html url for a folder if it's folder, otherwise for a dashboard
func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string {
if isFolder {
return GetFolderUrl(uid, slug)
}
return GetDashboardUrl(uid, slug)
}
// GetDashboardUrl return the html url for a dashboard
func GetDashboardUrl(uid string, slug string) string {
return fmt.Sprintf("%s/d/%s/%s", setting.AppSubUrl, uid, slug)
}
// GetFullDashboardUrl return the full url for a dashboard
func GetFullDashboardUrl(uid string, slug string) string {
return fmt.Sprintf("%sd/%s/%s", setting.AppUrl, uid, slug)
}
// GetFolderUrl return the html url for a folder
func GetFolderUrl(folderUid string, slug string) string {
return fmt.Sprintf("%s/dashboards/f/%s/%s", setting.AppSubUrl, folderUid, slug)
}
type ValidateDashboardBeforeSaveResult struct {
IsParentFolderChanged bool
}
//
// COMMANDS
//
type SaveDashboardCommand struct {
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
UserId int64 `json:"userId"`
Overwrite bool `json:"overwrite"`
Message string `json:"message"`
OrgId int64 `json:"-"`
RestoredFrom int `json:"-"`
PluginId string `json:"-"`
FolderId int64 `json:"folderId"`
IsFolder bool `json:"isFolder"`
UpdatedAt time.Time
Result *Dashboard
}
type DashboardProvisioning struct {
Id int64
DashboardId int64
Name string
ExternalId string
CheckSum string
Updated int64
}
type SaveProvisionedDashboardCommand struct {
DashboardCmd *SaveDashboardCommand
DashboardProvisioning *DashboardProvisioning
Result *Dashboard
}
type DeleteDashboardCommand struct {
Id int64
OrgId int64
}
type ValidateDashboardBeforeSaveCommand struct {
OrgId int64
Dashboard *Dashboard
Overwrite bool
Result *ValidateDashboardBeforeSaveResult
}
//
// QUERIES
//
type GetDashboardQuery struct {
Slug string // required if no Id or Uid is specified
Id int64 // optional if slug is set
Uid string // optional if slug is set
OrgId int64
Result *Dashboard
}
type DashboardTagCloudItem struct {
Term string `json:"term"`
Count int `json:"count"`
}
type GetDashboardTagsQuery struct {
OrgId int64
Result []*DashboardTagCloudItem
}
type GetDashboardsQuery struct {
DashboardIds []int64
Result []*Dashboard
}
type GetDashboardPermissionsForUserQuery struct {
DashboardIds []int64
OrgId int64
UserId int64
OrgRole RoleType
Result []*DashboardPermissionForUser
}
type GetDashboardsByPluginIdQuery struct {
OrgId int64
PluginId string
Result []*Dashboard
}
type GetDashboardSlugByIdQuery struct {
Id int64
Result string
}
type IsDashboardProvisionedQuery struct {
DashboardId int64
Result bool
}
type GetProvisionedDashboardDataQuery struct {
Name string
Result []*DashboardProvisioning
}
type GetDashboardsBySlugQuery struct {
OrgId int64
Slug string
Result []*Dashboard
}
type DashboardPermissionForUser struct {
DashboardId int64 `json:"dashboardId"`
Permission PermissionType `json:"permission"`
PermissionName string `json:"permissionName"`
}
type DashboardRef struct {
Uid string
Slug string
}
type GetDashboardRefByIdQuery struct {
Id int64
Result *DashboardRef
}
| pkg/models/dashboards.go | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00036879628896713257,
0.00018531677778810263,
0.0001672463840804994,
0.00017486815340816975,
0.00003439935244387016
] |
{
"id": 1,
"code_window": [
"}\n",
"\n",
"export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {\n",
" const handleChange = event => {\n",
" event.stopPropagation();\n",
" if (onChange) {\n",
" onChange(value);\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const ToggleButton: SFC<ToggleButtonProps> = ({\n",
" children,\n",
" selected,\n",
" className = '',\n",
" title = null,\n",
" value,\n",
" onChange,\n",
"}) => {\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 53
} | import React, { SFC, ReactNode, PureComponent, ReactElement } from 'react';
interface ToggleButtonGroupProps {
onChange: (value) => void;
value?: any;
label?: string;
render: (props) => void;
}
export default class ToggleButtonGroup extends PureComponent<ToggleButtonGroupProps> {
getValues() {
const { children } = this.props;
return React.Children.toArray(children).map((c: ReactElement<any>) => c.props.value);
}
smallChildren() {
const { children } = this.props;
return React.Children.toArray(children).every((c: ReactElement<any>) => c.props.className.includes('small'));
}
handleToggle(toggleValue) {
const { value, onChange } = this.props;
if (value && value === toggleValue) {
return;
}
onChange(toggleValue);
}
render() {
const { value, label } = this.props;
const values = this.getValues();
const selectedValue = value || values[0];
const labelClassName = `gf-form-label ${this.smallChildren() ? 'small' : ''}`;
return (
<div className="gf-form">
<div className="toggle-button-group">
{label && <label className={labelClassName}>{label}</label>}
{this.props.render({ selectedValue, onChange: this.handleToggle.bind(this) })}
</div>
</div>
);
}
}
interface ToggleButtonProps {
onChange?: (value) => void;
selected?: boolean;
value: any;
className?: string;
children: ReactNode;
}
export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {
const handleChange = event => {
event.stopPropagation();
if (onChange) {
onChange(value);
}
};
const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;
return (
<button className={btnClassName} onClick={handleChange}>
<span>{children}</span>
</button>
);
};
| public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx | 1 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.9986856579780579,
0.4861142933368683,
0.00017072472837753594,
0.40124383568763733,
0.46210870146751404
] |
{
"id": 1,
"code_window": [
"}\n",
"\n",
"export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {\n",
" const handleChange = event => {\n",
" event.stopPropagation();\n",
" if (onChange) {\n",
" onChange(value);\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const ToggleButton: SFC<ToggleButtonProps> = ({\n",
" children,\n",
" selected,\n",
" className = '',\n",
" title = null,\n",
" value,\n",
" onChange,\n",
"}) => {\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 53
} | // Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Functions to access/create device major and minor numbers matching the
// encoding used in Darwin's sys/types.h header.
package unix
// Major returns the major component of a Darwin device number.
func Major(dev uint64) uint32 {
return uint32((dev >> 24) & 0xff)
}
// Minor returns the minor component of a Darwin device number.
func Minor(dev uint64) uint32 {
return uint32(dev & 0xffffff)
}
// Mkdev returns a Darwin device number generated from the given major and minor
// components.
func Mkdev(major, minor uint32) uint64 {
return (uint64(major) << 24) | uint64(minor)
}
| vendor/golang.org/x/sys/unix/dev_darwin.go | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00017758960893843323,
0.0001713062374619767,
0.00016631875769235194,
0.00017001030209939927,
0.000004691664798883721
] |
{
"id": 1,
"code_window": [
"}\n",
"\n",
"export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {\n",
" const handleChange = event => {\n",
" event.stopPropagation();\n",
" if (onChange) {\n",
" onChange(value);\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const ToggleButton: SFC<ToggleButtonProps> = ({\n",
" children,\n",
" selected,\n",
" className = '',\n",
" title = null,\n",
" value,\n",
" onChange,\n",
"}) => {\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 53
} | /*
*
* Copyright 2014 gRPC authors.
*
* 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.
*
*/
package grpc
import (
"bytes"
"errors"
"fmt"
"io"
"math"
"net"
"net/http"
"reflect"
"runtime"
"strings"
"sync"
"time"
"io/ioutil"
"golang.org/x/net/context"
"golang.org/x/net/http2"
"golang.org/x/net/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/encoding"
"google.golang.org/grpc/encoding/proto"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/stats"
"google.golang.org/grpc/status"
"google.golang.org/grpc/tap"
"google.golang.org/grpc/transport"
)
const (
defaultServerMaxReceiveMessageSize = 1024 * 1024 * 4
defaultServerMaxSendMessageSize = math.MaxInt32
)
type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error)
// MethodDesc represents an RPC service's method specification.
type MethodDesc struct {
MethodName string
Handler methodHandler
}
// ServiceDesc represents an RPC service's specification.
type ServiceDesc struct {
ServiceName string
// The pointer to the service interface. Used to check whether the user
// provided implementation satisfies the interface requirements.
HandlerType interface{}
Methods []MethodDesc
Streams []StreamDesc
Metadata interface{}
}
// service consists of the information of the server serving this service and
// the methods in this service.
type service struct {
server interface{} // the server for service methods
md map[string]*MethodDesc
sd map[string]*StreamDesc
mdata interface{}
}
// Server is a gRPC server to serve RPC requests.
type Server struct {
opts options
mu sync.Mutex // guards following
lis map[net.Listener]bool
conns map[io.Closer]bool
serve bool
drain bool
cv *sync.Cond // signaled when connections close for GracefulStop
m map[string]*service // service name -> service info
events trace.EventLog
quit chan struct{}
done chan struct{}
quitOnce sync.Once
doneOnce sync.Once
serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop
}
type options struct {
creds credentials.TransportCredentials
codec baseCodec
cp Compressor
dc Decompressor
unaryInt UnaryServerInterceptor
streamInt StreamServerInterceptor
inTapHandle tap.ServerInHandle
statsHandler stats.Handler
maxConcurrentStreams uint32
maxReceiveMessageSize int
maxSendMessageSize int
useHandlerImpl bool // use http.Handler-based server
unknownStreamDesc *StreamDesc
keepaliveParams keepalive.ServerParameters
keepalivePolicy keepalive.EnforcementPolicy
initialWindowSize int32
initialConnWindowSize int32
writeBufferSize int
readBufferSize int
connectionTimeout time.Duration
}
var defaultServerOptions = options{
maxReceiveMessageSize: defaultServerMaxReceiveMessageSize,
maxSendMessageSize: defaultServerMaxSendMessageSize,
connectionTimeout: 120 * time.Second,
}
// A ServerOption sets options such as credentials, codec and keepalive parameters, etc.
type ServerOption func(*options)
// WriteBufferSize lets you set the size of write buffer, this determines how much data can be batched
// before doing a write on the wire.
func WriteBufferSize(s int) ServerOption {
return func(o *options) {
o.writeBufferSize = s
}
}
// ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most
// for one read syscall.
func ReadBufferSize(s int) ServerOption {
return func(o *options) {
o.readBufferSize = s
}
}
// InitialWindowSize returns a ServerOption that sets window size for stream.
// The lower bound for window size is 64K and any value smaller than that will be ignored.
func InitialWindowSize(s int32) ServerOption {
return func(o *options) {
o.initialWindowSize = s
}
}
// InitialConnWindowSize returns a ServerOption that sets window size for a connection.
// The lower bound for window size is 64K and any value smaller than that will be ignored.
func InitialConnWindowSize(s int32) ServerOption {
return func(o *options) {
o.initialConnWindowSize = s
}
}
// KeepaliveParams returns a ServerOption that sets keepalive and max-age parameters for the server.
func KeepaliveParams(kp keepalive.ServerParameters) ServerOption {
return func(o *options) {
o.keepaliveParams = kp
}
}
// KeepaliveEnforcementPolicy returns a ServerOption that sets keepalive enforcement policy for the server.
func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption {
return func(o *options) {
o.keepalivePolicy = kep
}
}
// CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling.
//
// This will override any lookups by content-subtype for Codecs registered with RegisterCodec.
func CustomCodec(codec Codec) ServerOption {
return func(o *options) {
o.codec = codec
}
}
// RPCCompressor returns a ServerOption that sets a compressor for outbound
// messages. For backward compatibility, all outbound messages will be sent
// using this compressor, regardless of incoming message compression. By
// default, server messages will be sent using the same compressor with which
// request messages were sent.
//
// Deprecated: use encoding.RegisterCompressor instead.
func RPCCompressor(cp Compressor) ServerOption {
return func(o *options) {
o.cp = cp
}
}
// RPCDecompressor returns a ServerOption that sets a decompressor for inbound
// messages. It has higher priority than decompressors registered via
// encoding.RegisterCompressor.
//
// Deprecated: use encoding.RegisterCompressor instead.
func RPCDecompressor(dc Decompressor) ServerOption {
return func(o *options) {
o.dc = dc
}
}
// MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive.
// If this is not set, gRPC uses the default limit. Deprecated: use MaxRecvMsgSize instead.
func MaxMsgSize(m int) ServerOption {
return MaxRecvMsgSize(m)
}
// MaxRecvMsgSize returns a ServerOption to set the max message size in bytes the server can receive.
// If this is not set, gRPC uses the default 4MB.
func MaxRecvMsgSize(m int) ServerOption {
return func(o *options) {
o.maxReceiveMessageSize = m
}
}
// MaxSendMsgSize returns a ServerOption to set the max message size in bytes the server can send.
// If this is not set, gRPC uses the default 4MB.
func MaxSendMsgSize(m int) ServerOption {
return func(o *options) {
o.maxSendMessageSize = m
}
}
// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number
// of concurrent streams to each ServerTransport.
func MaxConcurrentStreams(n uint32) ServerOption {
return func(o *options) {
o.maxConcurrentStreams = n
}
}
// Creds returns a ServerOption that sets credentials for server connections.
func Creds(c credentials.TransportCredentials) ServerOption {
return func(o *options) {
o.creds = c
}
}
// UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the
// server. Only one unary interceptor can be installed. The construction of multiple
// interceptors (e.g., chaining) can be implemented at the caller.
func UnaryInterceptor(i UnaryServerInterceptor) ServerOption {
return func(o *options) {
if o.unaryInt != nil {
panic("The unary server interceptor was already set and may not be reset.")
}
o.unaryInt = i
}
}
// StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the
// server. Only one stream interceptor can be installed.
func StreamInterceptor(i StreamServerInterceptor) ServerOption {
return func(o *options) {
if o.streamInt != nil {
panic("The stream server interceptor was already set and may not be reset.")
}
o.streamInt = i
}
}
// InTapHandle returns a ServerOption that sets the tap handle for all the server
// transport to be created. Only one can be installed.
func InTapHandle(h tap.ServerInHandle) ServerOption {
return func(o *options) {
if o.inTapHandle != nil {
panic("The tap handle was already set and may not be reset.")
}
o.inTapHandle = h
}
}
// StatsHandler returns a ServerOption that sets the stats handler for the server.
func StatsHandler(h stats.Handler) ServerOption {
return func(o *options) {
o.statsHandler = h
}
}
// UnknownServiceHandler returns a ServerOption that allows for adding a custom
// unknown service handler. The provided method is a bidi-streaming RPC service
// handler that will be invoked instead of returning the "unimplemented" gRPC
// error whenever a request is received for an unregistered service or method.
// The handling function has full access to the Context of the request and the
// stream, and the invocation bypasses interceptors.
func UnknownServiceHandler(streamHandler StreamHandler) ServerOption {
return func(o *options) {
o.unknownStreamDesc = &StreamDesc{
StreamName: "unknown_service_handler",
Handler: streamHandler,
// We need to assume that the users of the streamHandler will want to use both.
ClientStreams: true,
ServerStreams: true,
}
}
}
// ConnectionTimeout returns a ServerOption that sets the timeout for
// connection establishment (up to and including HTTP/2 handshaking) for all
// new connections. If this is not set, the default is 120 seconds. A zero or
// negative value will result in an immediate timeout.
//
// This API is EXPERIMENTAL.
func ConnectionTimeout(d time.Duration) ServerOption {
return func(o *options) {
o.connectionTimeout = d
}
}
// NewServer creates a gRPC server which has no service registered and has not
// started to accept requests yet.
func NewServer(opt ...ServerOption) *Server {
opts := defaultServerOptions
for _, o := range opt {
o(&opts)
}
s := &Server{
lis: make(map[net.Listener]bool),
opts: opts,
conns: make(map[io.Closer]bool),
m: make(map[string]*service),
quit: make(chan struct{}),
done: make(chan struct{}),
}
s.cv = sync.NewCond(&s.mu)
if EnableTracing {
_, file, line, _ := runtime.Caller(1)
s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line))
}
return s
}
// printf records an event in s's event log, unless s has been stopped.
// REQUIRES s.mu is held.
func (s *Server) printf(format string, a ...interface{}) {
if s.events != nil {
s.events.Printf(format, a...)
}
}
// errorf records an error in s's event log, unless s has been stopped.
// REQUIRES s.mu is held.
func (s *Server) errorf(format string, a ...interface{}) {
if s.events != nil {
s.events.Errorf(format, a...)
}
}
// RegisterService registers a service and its implementation to the gRPC
// server. It is called from the IDL generated code. This must be called before
// invoking Serve.
func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) {
ht := reflect.TypeOf(sd.HandlerType).Elem()
st := reflect.TypeOf(ss)
if !st.Implements(ht) {
grpclog.Fatalf("grpc: Server.RegisterService found the handler of type %v that does not satisfy %v", st, ht)
}
s.register(sd, ss)
}
func (s *Server) register(sd *ServiceDesc, ss interface{}) {
s.mu.Lock()
defer s.mu.Unlock()
s.printf("RegisterService(%q)", sd.ServiceName)
if s.serve {
grpclog.Fatalf("grpc: Server.RegisterService after Server.Serve for %q", sd.ServiceName)
}
if _, ok := s.m[sd.ServiceName]; ok {
grpclog.Fatalf("grpc: Server.RegisterService found duplicate service registration for %q", sd.ServiceName)
}
srv := &service{
server: ss,
md: make(map[string]*MethodDesc),
sd: make(map[string]*StreamDesc),
mdata: sd.Metadata,
}
for i := range sd.Methods {
d := &sd.Methods[i]
srv.md[d.MethodName] = d
}
for i := range sd.Streams {
d := &sd.Streams[i]
srv.sd[d.StreamName] = d
}
s.m[sd.ServiceName] = srv
}
// MethodInfo contains the information of an RPC including its method name and type.
type MethodInfo struct {
// Name is the method name only, without the service name or package name.
Name string
// IsClientStream indicates whether the RPC is a client streaming RPC.
IsClientStream bool
// IsServerStream indicates whether the RPC is a server streaming RPC.
IsServerStream bool
}
// ServiceInfo contains unary RPC method info, streaming RPC method info and metadata for a service.
type ServiceInfo struct {
Methods []MethodInfo
// Metadata is the metadata specified in ServiceDesc when registering service.
Metadata interface{}
}
// GetServiceInfo returns a map from service names to ServiceInfo.
// Service names include the package names, in the form of <package>.<service>.
func (s *Server) GetServiceInfo() map[string]ServiceInfo {
ret := make(map[string]ServiceInfo)
for n, srv := range s.m {
methods := make([]MethodInfo, 0, len(srv.md)+len(srv.sd))
for m := range srv.md {
methods = append(methods, MethodInfo{
Name: m,
IsClientStream: false,
IsServerStream: false,
})
}
for m, d := range srv.sd {
methods = append(methods, MethodInfo{
Name: m,
IsClientStream: d.ClientStreams,
IsServerStream: d.ServerStreams,
})
}
ret[n] = ServiceInfo{
Methods: methods,
Metadata: srv.mdata,
}
}
return ret
}
// ErrServerStopped indicates that the operation is now illegal because of
// the server being stopped.
var ErrServerStopped = errors.New("grpc: the server has been stopped")
func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
if s.opts.creds == nil {
return rawConn, nil, nil
}
return s.opts.creds.ServerHandshake(rawConn)
}
// Serve accepts incoming connections on the listener lis, creating a new
// ServerTransport and service goroutine for each. The service goroutines
// read gRPC requests and then call the registered handlers to reply to them.
// Serve returns when lis.Accept fails with fatal errors. lis will be closed when
// this method returns.
// Serve will return a non-nil error unless Stop or GracefulStop is called.
func (s *Server) Serve(lis net.Listener) error {
s.mu.Lock()
s.printf("serving")
s.serve = true
if s.lis == nil {
// Serve called after Stop or GracefulStop.
s.mu.Unlock()
lis.Close()
return ErrServerStopped
}
s.serveWG.Add(1)
defer func() {
s.serveWG.Done()
select {
// Stop or GracefulStop called; block until done and return nil.
case <-s.quit:
<-s.done
default:
}
}()
s.lis[lis] = true
s.mu.Unlock()
defer func() {
s.mu.Lock()
if s.lis != nil && s.lis[lis] {
lis.Close()
delete(s.lis, lis)
}
s.mu.Unlock()
}()
var tempDelay time.Duration // how long to sleep on accept failure
for {
rawConn, err := lis.Accept()
if err != nil {
if ne, ok := err.(interface {
Temporary() bool
}); ok && ne.Temporary() {
if tempDelay == 0 {
tempDelay = 5 * time.Millisecond
} else {
tempDelay *= 2
}
if max := 1 * time.Second; tempDelay > max {
tempDelay = max
}
s.mu.Lock()
s.printf("Accept error: %v; retrying in %v", err, tempDelay)
s.mu.Unlock()
timer := time.NewTimer(tempDelay)
select {
case <-timer.C:
case <-s.quit:
timer.Stop()
return nil
}
continue
}
s.mu.Lock()
s.printf("done serving; Accept = %v", err)
s.mu.Unlock()
select {
case <-s.quit:
return nil
default:
}
return err
}
tempDelay = 0
// Start a new goroutine to deal with rawConn so we don't stall this Accept
// loop goroutine.
//
// Make sure we account for the goroutine so GracefulStop doesn't nil out
// s.conns before this conn can be added.
s.serveWG.Add(1)
go func() {
s.handleRawConn(rawConn)
s.serveWG.Done()
}()
}
}
// handleRawConn forks a goroutine to handle a just-accepted connection that
// has not had any I/O performed on it yet.
func (s *Server) handleRawConn(rawConn net.Conn) {
rawConn.SetDeadline(time.Now().Add(s.opts.connectionTimeout))
conn, authInfo, err := s.useTransportAuthenticator(rawConn)
if err != nil {
s.mu.Lock()
s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err)
s.mu.Unlock()
grpclog.Warningf("grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err)
// If serverHandshake returns ErrConnDispatched, keep rawConn open.
if err != credentials.ErrConnDispatched {
rawConn.Close()
}
rawConn.SetDeadline(time.Time{})
return
}
s.mu.Lock()
if s.conns == nil {
s.mu.Unlock()
conn.Close()
return
}
s.mu.Unlock()
var serve func()
c := conn.(io.Closer)
if s.opts.useHandlerImpl {
serve = func() { s.serveUsingHandler(conn) }
} else {
// Finish handshaking (HTTP2)
st := s.newHTTP2Transport(conn, authInfo)
if st == nil {
return
}
c = st
serve = func() { s.serveStreams(st) }
}
rawConn.SetDeadline(time.Time{})
if !s.addConn(c) {
return
}
go func() {
serve()
s.removeConn(c)
}()
}
// newHTTP2Transport sets up a http/2 transport (using the
// gRPC http2 server transport in transport/http2_server.go).
func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) transport.ServerTransport {
config := &transport.ServerConfig{
MaxStreams: s.opts.maxConcurrentStreams,
AuthInfo: authInfo,
InTapHandle: s.opts.inTapHandle,
StatsHandler: s.opts.statsHandler,
KeepaliveParams: s.opts.keepaliveParams,
KeepalivePolicy: s.opts.keepalivePolicy,
InitialWindowSize: s.opts.initialWindowSize,
InitialConnWindowSize: s.opts.initialConnWindowSize,
WriteBufferSize: s.opts.writeBufferSize,
ReadBufferSize: s.opts.readBufferSize,
}
st, err := transport.NewServerTransport("http2", c, config)
if err != nil {
s.mu.Lock()
s.errorf("NewServerTransport(%q) failed: %v", c.RemoteAddr(), err)
s.mu.Unlock()
c.Close()
grpclog.Warningln("grpc: Server.Serve failed to create ServerTransport: ", err)
return nil
}
return st
}
func (s *Server) serveStreams(st transport.ServerTransport) {
defer st.Close()
var wg sync.WaitGroup
st.HandleStreams(func(stream *transport.Stream) {
wg.Add(1)
go func() {
defer wg.Done()
s.handleStream(st, stream, s.traceInfo(st, stream))
}()
}, func(ctx context.Context, method string) context.Context {
if !EnableTracing {
return ctx
}
tr := trace.New("grpc.Recv."+methodFamily(method), method)
return trace.NewContext(ctx, tr)
})
wg.Wait()
}
var _ http.Handler = (*Server)(nil)
// serveUsingHandler is called from handleRawConn when s is configured
// to handle requests via the http.Handler interface. It sets up a
// net/http.Server to handle the just-accepted conn. The http.Server
// is configured to route all incoming requests (all HTTP/2 streams)
// to ServeHTTP, which creates a new ServerTransport for each stream.
// serveUsingHandler blocks until conn closes.
//
// This codepath is only used when Server.TestingUseHandlerImpl has
// been configured. This lets the end2end tests exercise the ServeHTTP
// method as one of the environment types.
//
// conn is the *tls.Conn that's already been authenticated.
func (s *Server) serveUsingHandler(conn net.Conn) {
h2s := &http2.Server{
MaxConcurrentStreams: s.opts.maxConcurrentStreams,
}
h2s.ServeConn(conn, &http2.ServeConnOpts{
Handler: s,
})
}
// ServeHTTP implements the Go standard library's http.Handler
// interface by responding to the gRPC request r, by looking up
// the requested gRPC method in the gRPC server s.
//
// The provided HTTP request must have arrived on an HTTP/2
// connection. When using the Go standard library's server,
// practically this means that the Request must also have arrived
// over TLS.
//
// To share one port (such as 443 for https) between gRPC and an
// existing http.Handler, use a root http.Handler such as:
//
// if r.ProtoMajor == 2 && strings.HasPrefix(
// r.Header.Get("Content-Type"), "application/grpc") {
// grpcServer.ServeHTTP(w, r)
// } else {
// yourMux.ServeHTTP(w, r)
// }
//
// Note that ServeHTTP uses Go's HTTP/2 server implementation which is totally
// separate from grpc-go's HTTP/2 server. Performance and features may vary
// between the two paths. ServeHTTP does not support some gRPC features
// available through grpc-go's HTTP/2 server, and it is currently EXPERIMENTAL
// and subject to change.
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandler)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if !s.addConn(st) {
return
}
defer s.removeConn(st)
s.serveStreams(st)
}
// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled.
// If tracing is not enabled, it returns nil.
func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) {
tr, ok := trace.FromContext(stream.Context())
if !ok {
return nil
}
trInfo = &traceInfo{
tr: tr,
}
trInfo.firstLine.client = false
trInfo.firstLine.remoteAddr = st.RemoteAddr()
if dl, ok := stream.Context().Deadline(); ok {
trInfo.firstLine.deadline = dl.Sub(time.Now())
}
return trInfo
}
func (s *Server) addConn(c io.Closer) bool {
s.mu.Lock()
defer s.mu.Unlock()
if s.conns == nil {
c.Close()
return false
}
if s.drain {
// Transport added after we drained our existing conns: drain it
// immediately.
c.(transport.ServerTransport).Drain()
}
s.conns[c] = true
return true
}
func (s *Server) removeConn(c io.Closer) {
s.mu.Lock()
defer s.mu.Unlock()
if s.conns != nil {
delete(s.conns, c)
s.cv.Broadcast()
}
}
func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error {
var (
outPayload *stats.OutPayload
)
if s.opts.statsHandler != nil {
outPayload = &stats.OutPayload{}
}
hdr, data, err := encode(s.getCodec(stream.ContentSubtype()), msg, cp, outPayload, comp)
if err != nil {
grpclog.Errorln("grpc: server failed to encode response: ", err)
return err
}
if len(data) > s.opts.maxSendMessageSize {
return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(data), s.opts.maxSendMessageSize)
}
err = t.Write(stream, hdr, data, opts)
if err == nil && outPayload != nil {
outPayload.SentTime = time.Now()
s.opts.statsHandler.HandleRPC(stream.Context(), outPayload)
}
return err
}
func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) {
sh := s.opts.statsHandler
if sh != nil {
beginTime := time.Now()
begin := &stats.Begin{
BeginTime: beginTime,
}
sh.HandleRPC(stream.Context(), begin)
defer func() {
end := &stats.End{
BeginTime: beginTime,
EndTime: time.Now(),
}
if err != nil && err != io.EOF {
end.Error = toRPCErr(err)
}
sh.HandleRPC(stream.Context(), end)
}()
}
if trInfo != nil {
defer trInfo.tr.Finish()
trInfo.firstLine.client = false
trInfo.tr.LazyLog(&trInfo.firstLine, false)
defer func() {
if err != nil && err != io.EOF {
trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
trInfo.tr.SetError()
}
}()
}
// comp and cp are used for compression. decomp and dc are used for
// decompression. If comp and decomp are both set, they are the same;
// however they are kept separate to ensure that at most one of the
// compressor/decompressor variable pairs are set for use later.
var comp, decomp encoding.Compressor
var cp Compressor
var dc Decompressor
// If dc is set and matches the stream's compression, use it. Otherwise, try
// to find a matching registered compressor for decomp.
if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc {
dc = s.opts.dc
} else if rc != "" && rc != encoding.Identity {
decomp = encoding.GetCompressor(rc)
if decomp == nil {
st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc)
t.WriteStatus(stream, st)
return st.Err()
}
}
// If cp is set, use it. Otherwise, attempt to compress the response using
// the incoming message compression method.
//
// NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686.
if s.opts.cp != nil {
cp = s.opts.cp
stream.SetSendCompress(cp.Type())
} else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity {
// Legacy compressor not specified; attempt to respond with same encoding.
comp = encoding.GetCompressor(rc)
if comp != nil {
stream.SetSendCompress(rc)
}
}
p := &parser{r: stream}
pf, req, err := p.recvMsg(s.opts.maxReceiveMessageSize)
if err == io.EOF {
// The entire stream is done (for unary RPC only).
return err
}
if err == io.ErrUnexpectedEOF {
err = status.Errorf(codes.Internal, io.ErrUnexpectedEOF.Error())
}
if err != nil {
if st, ok := status.FromError(err); ok {
if e := t.WriteStatus(stream, st); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e)
}
} else {
switch st := err.(type) {
case transport.ConnectionError:
// Nothing to do here.
case transport.StreamError:
if e := t.WriteStatus(stream, status.New(st.Code, st.Desc)); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e)
}
default:
panic(fmt.Sprintf("grpc: Unexpected error (%T) from recvMsg: %v", st, st))
}
}
return err
}
if st := checkRecvPayload(pf, stream.RecvCompress(), dc != nil || decomp != nil); st != nil {
if e := t.WriteStatus(stream, st); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e)
}
return st.Err()
}
var inPayload *stats.InPayload
if sh != nil {
inPayload = &stats.InPayload{
RecvTime: time.Now(),
}
}
df := func(v interface{}) error {
if inPayload != nil {
inPayload.WireLength = len(req)
}
if pf == compressionMade {
var err error
if dc != nil {
req, err = dc.Do(bytes.NewReader(req))
if err != nil {
return status.Errorf(codes.Internal, err.Error())
}
} else {
tmp, _ := decomp.Decompress(bytes.NewReader(req))
req, err = ioutil.ReadAll(tmp)
if err != nil {
return status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
}
}
if len(req) > s.opts.maxReceiveMessageSize {
// TODO: Revisit the error code. Currently keep it consistent with
// java implementation.
return status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(req), s.opts.maxReceiveMessageSize)
}
if err := s.getCodec(stream.ContentSubtype()).Unmarshal(req, v); err != nil {
return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err)
}
if inPayload != nil {
inPayload.Payload = v
inPayload.Data = req
inPayload.Length = len(req)
sh.HandleRPC(stream.Context(), inPayload)
}
if trInfo != nil {
trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true)
}
return nil
}
ctx := NewContextWithServerTransportStream(stream.Context(), stream)
reply, appErr := md.Handler(srv.server, ctx, df, s.opts.unaryInt)
if appErr != nil {
appStatus, ok := status.FromError(appErr)
if !ok {
// Convert appErr if it is not a grpc status error.
appErr = status.Error(codes.Unknown, appErr.Error())
appStatus, _ = status.FromError(appErr)
}
if trInfo != nil {
trInfo.tr.LazyLog(stringer(appStatus.Message()), true)
trInfo.tr.SetError()
}
if e := t.WriteStatus(stream, appStatus); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status: %v", e)
}
return appErr
}
if trInfo != nil {
trInfo.tr.LazyLog(stringer("OK"), false)
}
opts := &transport.Options{
Last: true,
Delay: false,
}
if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil {
if err == io.EOF {
// The entire stream is done (for unary RPC only).
return err
}
if s, ok := status.FromError(err); ok {
if e := t.WriteStatus(stream, s); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status: %v", e)
}
} else {
switch st := err.(type) {
case transport.ConnectionError:
// Nothing to do here.
case transport.StreamError:
if e := t.WriteStatus(stream, status.New(st.Code, st.Desc)); e != nil {
grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e)
}
default:
panic(fmt.Sprintf("grpc: Unexpected error (%T) from sendResponse: %v", st, st))
}
}
return err
}
if trInfo != nil {
trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true)
}
// TODO: Should we be logging if writing status failed here, like above?
// Should the logging be in WriteStatus? Should we ignore the WriteStatus
// error or allow the stats handler to see it?
return t.WriteStatus(stream, status.New(codes.OK, ""))
}
func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) {
sh := s.opts.statsHandler
if sh != nil {
beginTime := time.Now()
begin := &stats.Begin{
BeginTime: beginTime,
}
sh.HandleRPC(stream.Context(), begin)
defer func() {
end := &stats.End{
BeginTime: beginTime,
EndTime: time.Now(),
}
if err != nil && err != io.EOF {
end.Error = toRPCErr(err)
}
sh.HandleRPC(stream.Context(), end)
}()
}
ctx := NewContextWithServerTransportStream(stream.Context(), stream)
ss := &serverStream{
ctx: ctx,
t: t,
s: stream,
p: &parser{r: stream},
codec: s.getCodec(stream.ContentSubtype()),
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
maxSendMessageSize: s.opts.maxSendMessageSize,
trInfo: trInfo,
statsHandler: sh,
}
// If dc is set and matches the stream's compression, use it. Otherwise, try
// to find a matching registered compressor for decomp.
if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc {
ss.dc = s.opts.dc
} else if rc != "" && rc != encoding.Identity {
ss.decomp = encoding.GetCompressor(rc)
if ss.decomp == nil {
st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc)
t.WriteStatus(ss.s, st)
return st.Err()
}
}
// If cp is set, use it. Otherwise, attempt to compress the response using
// the incoming message compression method.
//
// NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686.
if s.opts.cp != nil {
ss.cp = s.opts.cp
stream.SetSendCompress(s.opts.cp.Type())
} else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity {
// Legacy compressor not specified; attempt to respond with same encoding.
ss.comp = encoding.GetCompressor(rc)
if ss.comp != nil {
stream.SetSendCompress(rc)
}
}
if trInfo != nil {
trInfo.tr.LazyLog(&trInfo.firstLine, false)
defer func() {
ss.mu.Lock()
if err != nil && err != io.EOF {
ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
ss.trInfo.tr.SetError()
}
ss.trInfo.tr.Finish()
ss.trInfo.tr = nil
ss.mu.Unlock()
}()
}
var appErr error
var server interface{}
if srv != nil {
server = srv.server
}
if s.opts.streamInt == nil {
appErr = sd.Handler(server, ss)
} else {
info := &StreamServerInfo{
FullMethod: stream.Method(),
IsClientStream: sd.ClientStreams,
IsServerStream: sd.ServerStreams,
}
appErr = s.opts.streamInt(server, ss, info, sd.Handler)
}
if appErr != nil {
appStatus, ok := status.FromError(appErr)
if !ok {
switch err := appErr.(type) {
case transport.StreamError:
appStatus = status.New(err.Code, err.Desc)
default:
appStatus = status.New(codes.Unknown, appErr.Error())
}
appErr = appStatus.Err()
}
if trInfo != nil {
ss.mu.Lock()
ss.trInfo.tr.LazyLog(stringer(appStatus.Message()), true)
ss.trInfo.tr.SetError()
ss.mu.Unlock()
}
t.WriteStatus(ss.s, appStatus)
// TODO: Should we log an error from WriteStatus here and below?
return appErr
}
if trInfo != nil {
ss.mu.Lock()
ss.trInfo.tr.LazyLog(stringer("OK"), false)
ss.mu.Unlock()
}
return t.WriteStatus(ss.s, status.New(codes.OK, ""))
}
func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) {
sm := stream.Method()
if sm != "" && sm[0] == '/' {
sm = sm[1:]
}
pos := strings.LastIndex(sm, "/")
if pos == -1 {
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true)
trInfo.tr.SetError()
}
errDesc := fmt.Sprintf("malformed method name: %q", stream.Method())
if err := t.WriteStatus(stream, status.New(codes.ResourceExhausted, errDesc)); err != nil {
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
trInfo.tr.SetError()
}
grpclog.Warningf("grpc: Server.handleStream failed to write status: %v", err)
}
if trInfo != nil {
trInfo.tr.Finish()
}
return
}
service := sm[:pos]
method := sm[pos+1:]
srv, ok := s.m[service]
if !ok {
if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil {
s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo)
return
}
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"Unknown service %v", []interface{}{service}}, true)
trInfo.tr.SetError()
}
errDesc := fmt.Sprintf("unknown service %v", service)
if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil {
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
trInfo.tr.SetError()
}
grpclog.Warningf("grpc: Server.handleStream failed to write status: %v", err)
}
if trInfo != nil {
trInfo.tr.Finish()
}
return
}
// Unary RPC or Streaming RPC?
if md, ok := srv.md[method]; ok {
s.processUnaryRPC(t, stream, srv, md, trInfo)
return
}
if sd, ok := srv.sd[method]; ok {
s.processStreamingRPC(t, stream, srv, sd, trInfo)
return
}
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"Unknown method %v", []interface{}{method}}, true)
trInfo.tr.SetError()
}
if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil {
s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo)
return
}
errDesc := fmt.Sprintf("unknown method %v", method)
if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil {
if trInfo != nil {
trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true)
trInfo.tr.SetError()
}
grpclog.Warningf("grpc: Server.handleStream failed to write status: %v", err)
}
if trInfo != nil {
trInfo.tr.Finish()
}
}
// The key to save ServerTransportStream in the context.
type streamKey struct{}
// NewContextWithServerTransportStream creates a new context from ctx and
// attaches stream to it.
//
// This API is EXPERIMENTAL.
func NewContextWithServerTransportStream(ctx context.Context, stream ServerTransportStream) context.Context {
return context.WithValue(ctx, streamKey{}, stream)
}
// ServerTransportStream is a minimal interface that a transport stream must
// implement. This can be used to mock an actual transport stream for tests of
// handler code that use, for example, grpc.SetHeader (which requires some
// stream to be in context).
//
// See also NewContextWithServerTransportStream.
//
// This API is EXPERIMENTAL.
type ServerTransportStream interface {
Method() string
SetHeader(md metadata.MD) error
SendHeader(md metadata.MD) error
SetTrailer(md metadata.MD) error
}
// serverStreamFromContext returns the server stream saved in ctx. Returns
// nil if the given context has no stream associated with it (which implies
// it is not an RPC invocation context).
func serverTransportStreamFromContext(ctx context.Context) ServerTransportStream {
s, _ := ctx.Value(streamKey{}).(ServerTransportStream)
return s
}
// Stop stops the gRPC server. It immediately closes all open
// connections and listeners.
// It cancels all active RPCs on the server side and the corresponding
// pending RPCs on the client side will get notified by connection
// errors.
func (s *Server) Stop() {
s.quitOnce.Do(func() {
close(s.quit)
})
defer func() {
s.serveWG.Wait()
s.doneOnce.Do(func() {
close(s.done)
})
}()
s.mu.Lock()
listeners := s.lis
s.lis = nil
st := s.conns
s.conns = nil
// interrupt GracefulStop if Stop and GracefulStop are called concurrently.
s.cv.Broadcast()
s.mu.Unlock()
for lis := range listeners {
lis.Close()
}
for c := range st {
c.Close()
}
s.mu.Lock()
if s.events != nil {
s.events.Finish()
s.events = nil
}
s.mu.Unlock()
}
// GracefulStop stops the gRPC server gracefully. It stops the server from
// accepting new connections and RPCs and blocks until all the pending RPCs are
// finished.
func (s *Server) GracefulStop() {
s.quitOnce.Do(func() {
close(s.quit)
})
defer func() {
s.doneOnce.Do(func() {
close(s.done)
})
}()
s.mu.Lock()
if s.conns == nil {
s.mu.Unlock()
return
}
for lis := range s.lis {
lis.Close()
}
s.lis = nil
if !s.drain {
for c := range s.conns {
c.(transport.ServerTransport).Drain()
}
s.drain = true
}
// Wait for serving threads to be ready to exit. Only then can we be sure no
// new conns will be created.
s.mu.Unlock()
s.serveWG.Wait()
s.mu.Lock()
for len(s.conns) != 0 {
s.cv.Wait()
}
s.conns = nil
if s.events != nil {
s.events.Finish()
s.events = nil
}
s.mu.Unlock()
}
func init() {
internal.TestingUseHandlerImpl = func(arg interface{}) {
arg.(*Server).opts.useHandlerImpl = true
}
}
// contentSubtype must be lowercase
// cannot return nil
func (s *Server) getCodec(contentSubtype string) baseCodec {
if s.opts.codec != nil {
return s.opts.codec
}
if contentSubtype == "" {
return encoding.GetCodec(proto.Name)
}
codec := encoding.GetCodec(contentSubtype)
if codec == nil {
return encoding.GetCodec(proto.Name)
}
return codec
}
// SetHeader sets the header metadata.
// When called multiple times, all the provided metadata will be merged.
// All the metadata will be sent out when one of the following happens:
// - grpc.SendHeader() is called;
// - The first response is sent out;
// - An RPC status is sent out (error or success).
func SetHeader(ctx context.Context, md metadata.MD) error {
if md.Len() == 0 {
return nil
}
stream := serverTransportStreamFromContext(ctx)
if stream == nil {
return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx)
}
return stream.SetHeader(md)
}
// SendHeader sends header metadata. It may be called at most once.
// The provided md and headers set by SetHeader() will be sent.
func SendHeader(ctx context.Context, md metadata.MD) error {
stream := serverTransportStreamFromContext(ctx)
if stream == nil {
return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx)
}
if err := stream.SendHeader(md); err != nil {
return toRPCErr(err)
}
return nil
}
// SetTrailer sets the trailer metadata that will be sent when an RPC returns.
// When called more than once, all the provided metadata will be merged.
func SetTrailer(ctx context.Context, md metadata.MD) error {
if md.Len() == 0 {
return nil
}
stream := serverTransportStreamFromContext(ctx)
if stream == nil {
return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx)
}
return stream.SetTrailer(md)
}
| vendor/google.golang.org/grpc/server.go | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.0008421349339187145,
0.00018328985606785864,
0.000163696488016285,
0.00017533331993035972,
0.000060728954849764705
] |
{
"id": 1,
"code_window": [
"}\n",
"\n",
"export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {\n",
" const handleChange = event => {\n",
" event.stopPropagation();\n",
" if (onChange) {\n",
" onChange(value);\n",
" }\n"
],
"labels": [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
"export const ToggleButton: SFC<ToggleButtonProps> = ({\n",
" children,\n",
" selected,\n",
" className = '',\n",
" title = null,\n",
" value,\n",
" onChange,\n",
"}) => {\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 53
} | user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
| devenv/docker/blocks/graphite1/conf/etc/nginx/nginx.conf | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00017625506734475493,
0.00017396893235854805,
0.0001699590648058802,
0.00017442749231122434,
0.0000019317953956488054
] |
{
"id": 2,
"code_window": [
"\n",
" const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;\n",
" return (\n",
" <button className={btnClassName} onClick={handleChange}>\n",
" <span>{children}</span>\n",
" </button>\n",
" );\n",
"};"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <button className={btnClassName} onClick={handleChange} title={title}>\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 63
} | import React, { SFC, ReactNode, PureComponent, ReactElement } from 'react';
interface ToggleButtonGroupProps {
onChange: (value) => void;
value?: any;
label?: string;
render: (props) => void;
}
export default class ToggleButtonGroup extends PureComponent<ToggleButtonGroupProps> {
getValues() {
const { children } = this.props;
return React.Children.toArray(children).map((c: ReactElement<any>) => c.props.value);
}
smallChildren() {
const { children } = this.props;
return React.Children.toArray(children).every((c: ReactElement<any>) => c.props.className.includes('small'));
}
handleToggle(toggleValue) {
const { value, onChange } = this.props;
if (value && value === toggleValue) {
return;
}
onChange(toggleValue);
}
render() {
const { value, label } = this.props;
const values = this.getValues();
const selectedValue = value || values[0];
const labelClassName = `gf-form-label ${this.smallChildren() ? 'small' : ''}`;
return (
<div className="gf-form">
<div className="toggle-button-group">
{label && <label className={labelClassName}>{label}</label>}
{this.props.render({ selectedValue, onChange: this.handleToggle.bind(this) })}
</div>
</div>
);
}
}
interface ToggleButtonProps {
onChange?: (value) => void;
selected?: boolean;
value: any;
className?: string;
children: ReactNode;
}
export const ToggleButton: SFC<ToggleButtonProps> = ({ children, selected, className = '', value, onChange }) => {
const handleChange = event => {
event.stopPropagation();
if (onChange) {
onChange(value);
}
};
const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;
return (
<button className={btnClassName} onClick={handleChange}>
<span>{children}</span>
</button>
);
};
| public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx | 1 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.9984183311462402,
0.1447572261095047,
0.0010777555871754885,
0.0019054434960708022,
0.3485100567340851
] |
{
"id": 2,
"code_window": [
"\n",
" const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;\n",
" return (\n",
" <button className={btnClassName} onClick={handleChange}>\n",
" <span>{children}</span>\n",
" </button>\n",
" );\n",
"};"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <button className={btnClassName} onClick={handleChange} title={title}>\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 63
} | // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Note: the file data_test.go that is generated should not be checked in.
//go:generate go run maketables.go triegen.go
//go:generate go test -tags test
// Package norm contains types and functions for normalizing Unicode strings.
package norm // import "golang.org/x/text/unicode/norm"
import (
"unicode/utf8"
"golang.org/x/text/transform"
)
// A Form denotes a canonical representation of Unicode code points.
// The Unicode-defined normalization and equivalence forms are:
//
// NFC Unicode Normalization Form C
// NFD Unicode Normalization Form D
// NFKC Unicode Normalization Form KC
// NFKD Unicode Normalization Form KD
//
// For a Form f, this documentation uses the notation f(x) to mean
// the bytes or string x converted to the given form.
// A position n in x is called a boundary if conversion to the form can
// proceed independently on both sides:
// f(x) == append(f(x[0:n]), f(x[n:])...)
//
// References: http://unicode.org/reports/tr15/ and
// http://unicode.org/notes/tn5/.
type Form int
const (
NFC Form = iota
NFD
NFKC
NFKD
)
// Bytes returns f(b). May return b if f(b) = b.
func (f Form) Bytes(b []byte) []byte {
src := inputBytes(b)
ft := formTable[f]
n, ok := ft.quickSpan(src, 0, len(b), true)
if ok {
return b
}
out := make([]byte, n, len(b))
copy(out, b[0:n])
rb := reorderBuffer{f: *ft, src: src, nsrc: len(b), out: out, flushF: appendFlush}
return doAppendInner(&rb, n)
}
// String returns f(s).
func (f Form) String(s string) string {
src := inputString(s)
ft := formTable[f]
n, ok := ft.quickSpan(src, 0, len(s), true)
if ok {
return s
}
out := make([]byte, n, len(s))
copy(out, s[0:n])
rb := reorderBuffer{f: *ft, src: src, nsrc: len(s), out: out, flushF: appendFlush}
return string(doAppendInner(&rb, n))
}
// IsNormal returns true if b == f(b).
func (f Form) IsNormal(b []byte) bool {
src := inputBytes(b)
ft := formTable[f]
bp, ok := ft.quickSpan(src, 0, len(b), true)
if ok {
return true
}
rb := reorderBuffer{f: *ft, src: src, nsrc: len(b)}
rb.setFlusher(nil, cmpNormalBytes)
for bp < len(b) {
rb.out = b[bp:]
if bp = decomposeSegment(&rb, bp, true); bp < 0 {
return false
}
bp, _ = rb.f.quickSpan(rb.src, bp, len(b), true)
}
return true
}
func cmpNormalBytes(rb *reorderBuffer) bool {
b := rb.out
for i := 0; i < rb.nrune; i++ {
info := rb.rune[i]
if int(info.size) > len(b) {
return false
}
p := info.pos
pe := p + info.size
for ; p < pe; p++ {
if b[0] != rb.byte[p] {
return false
}
b = b[1:]
}
}
return true
}
// IsNormalString returns true if s == f(s).
func (f Form) IsNormalString(s string) bool {
src := inputString(s)
ft := formTable[f]
bp, ok := ft.quickSpan(src, 0, len(s), true)
if ok {
return true
}
rb := reorderBuffer{f: *ft, src: src, nsrc: len(s)}
rb.setFlusher(nil, func(rb *reorderBuffer) bool {
for i := 0; i < rb.nrune; i++ {
info := rb.rune[i]
if bp+int(info.size) > len(s) {
return false
}
p := info.pos
pe := p + info.size
for ; p < pe; p++ {
if s[bp] != rb.byte[p] {
return false
}
bp++
}
}
return true
})
for bp < len(s) {
if bp = decomposeSegment(&rb, bp, true); bp < 0 {
return false
}
bp, _ = rb.f.quickSpan(rb.src, bp, len(s), true)
}
return true
}
// patchTail fixes a case where a rune may be incorrectly normalized
// if it is followed by illegal continuation bytes. It returns the
// patched buffer and whether the decomposition is still in progress.
func patchTail(rb *reorderBuffer) bool {
info, p := lastRuneStart(&rb.f, rb.out)
if p == -1 || info.size == 0 {
return true
}
end := p + int(info.size)
extra := len(rb.out) - end
if extra > 0 {
// Potentially allocating memory. However, this only
// happens with ill-formed UTF-8.
x := make([]byte, 0)
x = append(x, rb.out[len(rb.out)-extra:]...)
rb.out = rb.out[:end]
decomposeToLastBoundary(rb)
rb.doFlush()
rb.out = append(rb.out, x...)
return false
}
buf := rb.out[p:]
rb.out = rb.out[:p]
decomposeToLastBoundary(rb)
if s := rb.ss.next(info); s == ssStarter {
rb.doFlush()
rb.ss.first(info)
} else if s == ssOverflow {
rb.doFlush()
rb.insertCGJ()
rb.ss = 0
}
rb.insertUnsafe(inputBytes(buf), 0, info)
return true
}
func appendQuick(rb *reorderBuffer, i int) int {
if rb.nsrc == i {
return i
}
end, _ := rb.f.quickSpan(rb.src, i, rb.nsrc, true)
rb.out = rb.src.appendSlice(rb.out, i, end)
return end
}
// Append returns f(append(out, b...)).
// The buffer out must be nil, empty, or equal to f(out).
func (f Form) Append(out []byte, src ...byte) []byte {
return f.doAppend(out, inputBytes(src), len(src))
}
func (f Form) doAppend(out []byte, src input, n int) []byte {
if n == 0 {
return out
}
ft := formTable[f]
// Attempt to do a quickSpan first so we can avoid initializing the reorderBuffer.
if len(out) == 0 {
p, _ := ft.quickSpan(src, 0, n, true)
out = src.appendSlice(out, 0, p)
if p == n {
return out
}
rb := reorderBuffer{f: *ft, src: src, nsrc: n, out: out, flushF: appendFlush}
return doAppendInner(&rb, p)
}
rb := reorderBuffer{f: *ft, src: src, nsrc: n}
return doAppend(&rb, out, 0)
}
func doAppend(rb *reorderBuffer, out []byte, p int) []byte {
rb.setFlusher(out, appendFlush)
src, n := rb.src, rb.nsrc
doMerge := len(out) > 0
if q := src.skipContinuationBytes(p); q > p {
// Move leading non-starters to destination.
rb.out = src.appendSlice(rb.out, p, q)
p = q
doMerge = patchTail(rb)
}
fd := &rb.f
if doMerge {
var info Properties
if p < n {
info = fd.info(src, p)
if !info.BoundaryBefore() || info.nLeadingNonStarters() > 0 {
if p == 0 {
decomposeToLastBoundary(rb)
}
p = decomposeSegment(rb, p, true)
}
}
if info.size == 0 {
rb.doFlush()
// Append incomplete UTF-8 encoding.
return src.appendSlice(rb.out, p, n)
}
if rb.nrune > 0 {
return doAppendInner(rb, p)
}
}
p = appendQuick(rb, p)
return doAppendInner(rb, p)
}
func doAppendInner(rb *reorderBuffer, p int) []byte {
for n := rb.nsrc; p < n; {
p = decomposeSegment(rb, p, true)
p = appendQuick(rb, p)
}
return rb.out
}
// AppendString returns f(append(out, []byte(s))).
// The buffer out must be nil, empty, or equal to f(out).
func (f Form) AppendString(out []byte, src string) []byte {
return f.doAppend(out, inputString(src), len(src))
}
// QuickSpan returns a boundary n such that b[0:n] == f(b[0:n]).
// It is not guaranteed to return the largest such n.
func (f Form) QuickSpan(b []byte) int {
n, _ := formTable[f].quickSpan(inputBytes(b), 0, len(b), true)
return n
}
// Span implements transform.SpanningTransformer. It returns a boundary n such
// that b[0:n] == f(b[0:n]). It is not guaranteed to return the largest such n.
func (f Form) Span(b []byte, atEOF bool) (n int, err error) {
n, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), atEOF)
if n < len(b) {
if !ok {
err = transform.ErrEndOfSpan
} else {
err = transform.ErrShortSrc
}
}
return n, err
}
// SpanString returns a boundary n such that s[0:n] == f(s[0:n]).
// It is not guaranteed to return the largest such n.
func (f Form) SpanString(s string, atEOF bool) (n int, err error) {
n, ok := formTable[f].quickSpan(inputString(s), 0, len(s), atEOF)
if n < len(s) {
if !ok {
err = transform.ErrEndOfSpan
} else {
err = transform.ErrShortSrc
}
}
return n, err
}
// quickSpan returns a boundary n such that src[0:n] == f(src[0:n]) and
// whether any non-normalized parts were found. If atEOF is false, n will
// not point past the last segment if this segment might be become
// non-normalized by appending other runes.
func (f *formInfo) quickSpan(src input, i, end int, atEOF bool) (n int, ok bool) {
var lastCC uint8
ss := streamSafe(0)
lastSegStart := i
for n = end; i < n; {
if j := src.skipASCII(i, n); i != j {
i = j
lastSegStart = i - 1
lastCC = 0
ss = 0
continue
}
info := f.info(src, i)
if info.size == 0 {
if atEOF {
// include incomplete runes
return n, true
}
return lastSegStart, true
}
// This block needs to be before the next, because it is possible to
// have an overflow for runes that are starters (e.g. with U+FF9E).
switch ss.next(info) {
case ssStarter:
lastSegStart = i
case ssOverflow:
return lastSegStart, false
case ssSuccess:
if lastCC > info.ccc {
return lastSegStart, false
}
}
if f.composing {
if !info.isYesC() {
break
}
} else {
if !info.isYesD() {
break
}
}
lastCC = info.ccc
i += int(info.size)
}
if i == n {
if !atEOF {
n = lastSegStart
}
return n, true
}
return lastSegStart, false
}
// QuickSpanString returns a boundary n such that s[0:n] == f(s[0:n]).
// It is not guaranteed to return the largest such n.
func (f Form) QuickSpanString(s string) int {
n, _ := formTable[f].quickSpan(inputString(s), 0, len(s), true)
return n
}
// FirstBoundary returns the position i of the first boundary in b
// or -1 if b contains no boundary.
func (f Form) FirstBoundary(b []byte) int {
return f.firstBoundary(inputBytes(b), len(b))
}
func (f Form) firstBoundary(src input, nsrc int) int {
i := src.skipContinuationBytes(0)
if i >= nsrc {
return -1
}
fd := formTable[f]
ss := streamSafe(0)
// We should call ss.first here, but we can't as the first rune is
// skipped already. This means FirstBoundary can't really determine
// CGJ insertion points correctly. Luckily it doesn't have to.
for {
info := fd.info(src, i)
if info.size == 0 {
return -1
}
if s := ss.next(info); s != ssSuccess {
return i
}
i += int(info.size)
if i >= nsrc {
if !info.BoundaryAfter() && !ss.isMax() {
return -1
}
return nsrc
}
}
}
// FirstBoundaryInString returns the position i of the first boundary in s
// or -1 if s contains no boundary.
func (f Form) FirstBoundaryInString(s string) int {
return f.firstBoundary(inputString(s), len(s))
}
// NextBoundary reports the index of the boundary between the first and next
// segment in b or -1 if atEOF is false and there are not enough bytes to
// determine this boundary.
func (f Form) NextBoundary(b []byte, atEOF bool) int {
return f.nextBoundary(inputBytes(b), len(b), atEOF)
}
// NextBoundaryInString reports the index of the boundary between the first and
// next segment in b or -1 if atEOF is false and there are not enough bytes to
// determine this boundary.
func (f Form) NextBoundaryInString(s string, atEOF bool) int {
return f.nextBoundary(inputString(s), len(s), atEOF)
}
func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int {
if nsrc == 0 {
if atEOF {
return 0
}
return -1
}
fd := formTable[f]
info := fd.info(src, 0)
if info.size == 0 {
if atEOF {
return 1
}
return -1
}
ss := streamSafe(0)
ss.first(info)
for i := int(info.size); i < nsrc; i += int(info.size) {
info = fd.info(src, i)
if info.size == 0 {
if atEOF {
return i
}
return -1
}
// TODO: Using streamSafe to determine the boundary isn't the same as
// using BoundaryBefore. Determine which should be used.
if s := ss.next(info); s != ssSuccess {
return i
}
}
if !atEOF && !info.BoundaryAfter() && !ss.isMax() {
return -1
}
return nsrc
}
// LastBoundary returns the position i of the last boundary in b
// or -1 if b contains no boundary.
func (f Form) LastBoundary(b []byte) int {
return lastBoundary(formTable[f], b)
}
func lastBoundary(fd *formInfo, b []byte) int {
i := len(b)
info, p := lastRuneStart(fd, b)
if p == -1 {
return -1
}
if info.size == 0 { // ends with incomplete rune
if p == 0 { // starts with incomplete rune
return -1
}
i = p
info, p = lastRuneStart(fd, b[:i])
if p == -1 { // incomplete UTF-8 encoding or non-starter bytes without a starter
return i
}
}
if p+int(info.size) != i { // trailing non-starter bytes: illegal UTF-8
return i
}
if info.BoundaryAfter() {
return i
}
ss := streamSafe(0)
v := ss.backwards(info)
for i = p; i >= 0 && v != ssStarter; i = p {
info, p = lastRuneStart(fd, b[:i])
if v = ss.backwards(info); v == ssOverflow {
break
}
if p+int(info.size) != i {
if p == -1 { // no boundary found
return -1
}
return i // boundary after an illegal UTF-8 encoding
}
}
return i
}
// decomposeSegment scans the first segment in src into rb. It inserts 0x034f
// (Grapheme Joiner) when it encounters a sequence of more than 30 non-starters
// and returns the number of bytes consumed from src or iShortDst or iShortSrc.
func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int {
// Force one character to be consumed.
info := rb.f.info(rb.src, sp)
if info.size == 0 {
return 0
}
if s := rb.ss.next(info); s == ssStarter {
// TODO: this could be removed if we don't support merging.
if rb.nrune > 0 {
goto end
}
} else if s == ssOverflow {
rb.insertCGJ()
goto end
}
if err := rb.insertFlush(rb.src, sp, info); err != iSuccess {
return int(err)
}
for {
sp += int(info.size)
if sp >= rb.nsrc {
if !atEOF && !info.BoundaryAfter() {
return int(iShortSrc)
}
break
}
info = rb.f.info(rb.src, sp)
if info.size == 0 {
if !atEOF {
return int(iShortSrc)
}
break
}
if s := rb.ss.next(info); s == ssStarter {
break
} else if s == ssOverflow {
rb.insertCGJ()
break
}
if err := rb.insertFlush(rb.src, sp, info); err != iSuccess {
return int(err)
}
}
end:
if !rb.doFlush() {
return int(iShortDst)
}
return sp
}
// lastRuneStart returns the runeInfo and position of the last
// rune in buf or the zero runeInfo and -1 if no rune was found.
func lastRuneStart(fd *formInfo, buf []byte) (Properties, int) {
p := len(buf) - 1
for ; p >= 0 && !utf8.RuneStart(buf[p]); p-- {
}
if p < 0 {
return Properties{}, -1
}
return fd.info(inputBytes(buf), p), p
}
// decomposeToLastBoundary finds an open segment at the end of the buffer
// and scans it into rb. Returns the buffer minus the last segment.
func decomposeToLastBoundary(rb *reorderBuffer) {
fd := &rb.f
info, i := lastRuneStart(fd, rb.out)
if int(info.size) != len(rb.out)-i {
// illegal trailing continuation bytes
return
}
if info.BoundaryAfter() {
return
}
var add [maxNonStarters + 1]Properties // stores runeInfo in reverse order
padd := 0
ss := streamSafe(0)
p := len(rb.out)
for {
add[padd] = info
v := ss.backwards(info)
if v == ssOverflow {
// Note that if we have an overflow, it the string we are appending to
// is not correctly normalized. In this case the behavior is undefined.
break
}
padd++
p -= int(info.size)
if v == ssStarter || p < 0 {
break
}
info, i = lastRuneStart(fd, rb.out[:p])
if int(info.size) != p-i {
break
}
}
rb.ss = ss
// Copy bytes for insertion as we may need to overwrite rb.out.
var buf [maxBufferSize * utf8.UTFMax]byte
cp := buf[:copy(buf[:], rb.out[p:])]
rb.out = rb.out[:p]
for padd--; padd >= 0; padd-- {
info = add[padd]
rb.insertUnsafe(inputBytes(cp), 0, info)
cp = cp[info.size:]
}
}
| vendor/golang.org/x/text/unicode/norm/normalize.go | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.0006897341227158904,
0.00018558227748144418,
0.0001608404709259048,
0.00017239492444787174,
0.00007029742118902504
] |
{
"id": 2,
"code_window": [
"\n",
" const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;\n",
" return (\n",
" <button className={btnClassName} onClick={handleChange}>\n",
" <span>{children}</span>\n",
" </button>\n",
" );\n",
"};"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <button className={btnClassName} onClick={handleChange} title={title}>\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 63
} | import { Action, ActionTypes } from 'app/core/actions/navModel';
import { NavIndex, NavModelItem } from 'app/types';
import config from 'app/core/config';
export function buildInitialState(): NavIndex {
const navIndex: NavIndex = {};
const rootNodes = config.bootData.navTree as NavModelItem[];
buildNavIndex(navIndex, rootNodes);
return navIndex;
}
function buildNavIndex(navIndex: NavIndex, children: NavModelItem[], parentItem?: NavModelItem) {
for (const node of children) {
navIndex[node.id] = {
...node,
parentItem: parentItem,
};
if (node.children) {
buildNavIndex(navIndex, node.children, node);
}
}
}
export const initialState: NavIndex = buildInitialState();
export const navIndexReducer = (state = initialState, action: Action): NavIndex => {
switch (action.type) {
case ActionTypes.UpdateNavIndex:
const newPages = {};
const payload = action.payload;
for (const node of payload.children) {
newPages[node.id] = {
...node,
parentItem: payload,
};
}
return { ...state, ...newPages };
}
return state;
};
| public/app/core/reducers/navModel.ts | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00030977505957707763,
0.00021285195543896407,
0.00017236040730495006,
0.00017713166016619653,
0.00005341717405826785
] |
{
"id": 2,
"code_window": [
"\n",
" const btnClassName = `btn ${className} ${selected ? 'active' : ''}`;\n",
" return (\n",
" <button className={btnClassName} onClick={handleChange}>\n",
" <span>{children}</span>\n",
" </button>\n",
" );\n",
"};"
],
"labels": [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
],
"after_edit": [
" <button className={btnClassName} onClick={handleChange} title={title}>\n"
],
"file_path": "public/app/core/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"type": "replace",
"edit_start_line_idx": 63
} | import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
export class UtilSrv {
modalScope: any;
/** @ngInject */
constructor(private $rootScope, private $modal) {}
init() {
appEvents.on('show-modal', this.showModal.bind(this), this.$rootScope);
appEvents.on('hide-modal', this.hideModal.bind(this), this.$rootScope);
appEvents.on('confirm-modal', this.showConfirmModal.bind(this), this.$rootScope);
}
hideModal() {
if (this.modalScope && this.modalScope.dismiss) {
this.modalScope.dismiss();
}
}
showModal(options) {
if (this.modalScope && this.modalScope.dismiss) {
this.modalScope.dismiss();
}
this.modalScope = options.scope;
if (options.model) {
this.modalScope = this.$rootScope.$new();
this.modalScope.model = options.model;
} else if (!this.modalScope) {
this.modalScope = this.$rootScope.$new();
}
const modal = this.$modal({
modalClass: options.modalClass,
template: options.src,
templateHtml: options.templateHtml,
persist: false,
show: false,
scope: this.modalScope,
keyboard: false,
backdrop: options.backdrop,
});
Promise.resolve(modal).then(modalEl => {
modalEl.modal('show');
});
}
showConfirmModal(payload) {
const scope = this.$rootScope.$new();
scope.onConfirm = () => {
payload.onConfirm();
scope.dismiss();
};
scope.updateConfirmText = value => {
scope.confirmTextValid = payload.confirmText.toLowerCase() === value.toLowerCase();
};
scope.title = payload.title;
scope.text = payload.text;
scope.text2 = payload.text2;
scope.confirmText = payload.confirmText;
scope.onConfirm = payload.onConfirm;
scope.onAltAction = payload.onAltAction;
scope.altActionText = payload.altActionText;
scope.icon = payload.icon || 'fa-check';
scope.yesText = payload.yesText || 'Yes';
scope.noText = payload.noText || 'Cancel';
scope.confirmTextValid = scope.confirmText ? false : true;
appEvents.emit('show-modal', {
src: 'public/app/partials/confirm_modal.html',
scope: scope,
modalClass: 'confirm-modal',
});
}
}
coreModule.service('utilSrv', UtilSrv);
| public/app/core/services/util_srv.ts | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.00017720903269946575,
0.00017391149594914168,
0.000169942548382096,
0.00017388882406521589,
0.000002071112021440058
] |
{
"id": 3,
"code_window": [
" [key: string]: string;\n",
"}\n",
"\n",
"export enum LogsDedupStrategy {\n",
" none = 'none',\n",
" exact = 'exact',\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"export enum LogsDedupDescription {\n",
" none = 'No de-duplication',\n",
" exact = 'De-duplication of successive lines that are identical, ignoring ISO datetimes.',\n",
" numbers = 'De-duplication of successive lines that are identical when ignoring numbers, e.g., IP addresses, latencies.',\n",
" signature = 'De-duplication of successive lines that have identical punctuation and whitespace.',\n",
"}\n",
"\n"
],
"file_path": "public/app/core/logs_model.ts",
"type": "add",
"edit_start_line_idx": 90
} | import _ from 'lodash';
import React, { PureComponent } from 'react';
import Highlighter from 'react-highlight-words';
import classnames from 'classnames';
import * as rangeUtil from 'app/core/utils/rangeutil';
import { RawTimeRange } from 'app/types/series';
import {
LogsDedupStrategy,
LogsModel,
dedupLogRows,
filterLogLevels,
getParser,
LogLevel,
LogsMetaKind,
LogsLabelStat,
LogsParser,
LogRow,
calculateFieldStats,
} from 'app/core/logs_model';
import { findHighlightChunksInText } from 'app/core/utils/text';
import { Switch } from 'app/core/components/Switch/Switch';
import ToggleButtonGroup, { ToggleButton } from 'app/core/components/ToggleButtonGroup/ToggleButtonGroup';
import Graph from './Graph';
import LogLabels, { Stats } from './LogLabels';
const PREVIEW_LIMIT = 100;
const graphOptions = {
series: {
stack: true,
bars: {
show: true,
lineWidth: 5,
// barWidth: 10,
},
// stack: true,
},
yaxis: {
tickDecimals: 0,
},
};
/**
* Renders a highlighted field.
* When hovering, a stats icon is shown.
*/
const FieldHighlight = onClick => props => {
return (
<span className={props.className} style={props.style}>
{props.children}
<span className="logs-row__field-highlight--icon fa fa-signal" onClick={() => onClick(props.children)} />
</span>
);
};
interface RowProps {
allRows: LogRow[];
highlighterExpressions?: string[];
row: LogRow;
showDuplicates: boolean;
showLabels: boolean | null; // Tristate: null means auto
showLocalTime: boolean;
showUtc: boolean;
onClickLabel?: (label: string, value: string) => void;
}
interface RowState {
fieldCount: number;
fieldLabel: string;
fieldStats: LogsLabelStat[];
fieldValue: string;
parsed: boolean;
parser: LogsParser;
parsedFieldHighlights: string[];
showFieldStats: boolean;
}
/**
* Renders a log line.
*
* When user hovers over it for a certain time, it lazily parses the log line.
* Once a parser is found, it will determine fields, that will be highlighted.
* When the user requests stats for a field, they will be calculated and rendered below the row.
*/
class Row extends PureComponent<RowProps, RowState> {
mouseMessageTimer: NodeJS.Timer;
state = {
fieldCount: 0,
fieldLabel: null,
fieldStats: null,
fieldValue: null,
parsed: false,
parser: null,
parsedFieldHighlights: [],
showFieldStats: false,
};
componentWillUnmount() {
clearTimeout(this.mouseMessageTimer);
}
onClickClose = () => {
this.setState({ showFieldStats: false });
};
onClickHighlight = (fieldText: string) => {
const { allRows } = this.props;
const { parser } = this.state;
const fieldMatch = fieldText.match(parser.fieldRegex);
if (fieldMatch) {
// Build value-agnostic row matcher based on the field label
const fieldLabel = fieldMatch[1];
const fieldValue = fieldMatch[2];
const matcher = parser.buildMatcher(fieldLabel);
const fieldStats = calculateFieldStats(allRows, matcher);
const fieldCount = fieldStats.reduce((sum, stat) => sum + stat.count, 0);
this.setState({ fieldCount, fieldLabel, fieldStats, fieldValue, showFieldStats: true });
}
};
onMouseOverMessage = () => {
// Don't parse right away, user might move along
this.mouseMessageTimer = setTimeout(this.parseMessage, 500);
};
onMouseOutMessage = () => {
clearTimeout(this.mouseMessageTimer);
this.setState({ parsed: false });
};
parseMessage = () => {
if (!this.state.parsed) {
const { row } = this.props;
const parser = getParser(row.entry);
if (parser) {
// Use parser to highlight detected fields
const parsedFieldHighlights = [];
this.props.row.entry.replace(new RegExp(parser.fieldRegex, 'g'), substring => {
parsedFieldHighlights.push(substring.trim());
return '';
});
this.setState({ parsedFieldHighlights, parsed: true, parser });
}
}
};
render() {
const {
allRows,
highlighterExpressions,
onClickLabel,
row,
showDuplicates,
showLabels,
showLocalTime,
showUtc,
} = this.props;
const {
fieldCount,
fieldLabel,
fieldStats,
fieldValue,
parsed,
parsedFieldHighlights,
showFieldStats,
} = this.state;
const previewHighlights = highlighterExpressions && !_.isEqual(highlighterExpressions, row.searchWords);
const highlights = previewHighlights ? highlighterExpressions : row.searchWords;
const needsHighlighter = highlights && highlights.length > 0;
const highlightClassName = classnames('logs-row__match-highlight', {
'logs-row__match-highlight--preview': previewHighlights,
});
return (
<div className="logs-row">
{showDuplicates && (
<div className="logs-row__duplicates">{row.duplicates > 0 ? `${row.duplicates + 1}x` : null}</div>
)}
<div className={row.logLevel ? `logs-row__level logs-row__level--${row.logLevel}` : ''} />
{showUtc && (
<div className="logs-row__time" title={`Local: ${row.timeLocal} (${row.timeFromNow})`}>
{row.timestamp}
</div>
)}
{showLocalTime && (
<div className="logs-row__time" title={`${row.timestamp} (${row.timeFromNow})`}>
{row.timeLocal}
</div>
)}
{showLabels && (
<div className="logs-row__labels">
<LogLabels allRows={allRows} labels={row.uniqueLabels} onClickLabel={onClickLabel} />
</div>
)}
<div className="logs-row__message" onMouseEnter={this.onMouseOverMessage} onMouseLeave={this.onMouseOutMessage}>
{parsed && (
<Highlighter
autoEscape
highlightTag={FieldHighlight(this.onClickHighlight)}
textToHighlight={row.entry}
searchWords={parsedFieldHighlights}
highlightClassName="logs-row__field-highlight"
/>
)}
{!parsed &&
needsHighlighter && (
<Highlighter
textToHighlight={row.entry}
searchWords={highlights}
findChunks={findHighlightChunksInText}
highlightClassName={highlightClassName}
/>
)}
{!parsed && !needsHighlighter && row.entry}
{showFieldStats && (
<div className="logs-row__stats">
<Stats
stats={fieldStats}
label={fieldLabel}
value={fieldValue}
onClickClose={this.onClickClose}
rowCount={fieldCount}
/>
</div>
)}
</div>
</div>
);
}
}
function renderMetaItem(value: any, kind: LogsMetaKind) {
if (kind === LogsMetaKind.LabelsMap) {
return (
<span className="logs-meta-item__labels">
<LogLabels labels={value} plain />
</span>
);
}
return value;
}
interface LogsProps {
data: LogsModel;
highlighterExpressions: string[];
loading: boolean;
position: string;
range?: RawTimeRange;
scanning?: boolean;
scanRange?: RawTimeRange;
onChangeTime?: (range: RawTimeRange) => void;
onClickLabel?: (label: string, value: string) => void;
onStartScanning?: () => void;
onStopScanning?: () => void;
}
interface LogsState {
dedup: LogsDedupStrategy;
deferLogs: boolean;
hiddenLogLevels: Set<LogLevel>;
renderAll: boolean;
showLabels: boolean | null; // Tristate: null means auto
showLocalTime: boolean;
showUtc: boolean;
}
export default class Logs extends PureComponent<LogsProps, LogsState> {
deferLogsTimer: NodeJS.Timer;
renderAllTimer: NodeJS.Timer;
state = {
dedup: LogsDedupStrategy.none,
deferLogs: true,
hiddenLogLevels: new Set(),
renderAll: false,
showLabels: null,
showLocalTime: true,
showUtc: false,
};
componentDidMount() {
// Staged rendering
if (this.state.deferLogs) {
const { data } = this.props;
const rowCount = data && data.rows ? data.rows.length : 0;
// Render all right away if not too far over the limit
const renderAll = rowCount <= PREVIEW_LIMIT * 2;
this.deferLogsTimer = setTimeout(() => this.setState({ deferLogs: false, renderAll }), rowCount);
}
}
componentDidUpdate(prevProps, prevState) {
// Staged rendering
if (prevState.deferLogs && !this.state.deferLogs && !this.state.renderAll) {
this.renderAllTimer = setTimeout(() => this.setState({ renderAll: true }), 2000);
}
}
componentWillUnmount() {
clearTimeout(this.deferLogsTimer);
clearTimeout(this.renderAllTimer);
}
onChangeDedup = (dedup: LogsDedupStrategy) => {
this.setState(prevState => {
if (prevState.dedup === dedup) {
return { dedup: LogsDedupStrategy.none };
}
return { dedup };
});
};
onChangeLabels = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showLabels: target.checked,
});
};
onChangeLocalTime = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showLocalTime: target.checked,
});
};
onChangeUtc = (event: React.SyntheticEvent) => {
const target = event.target as HTMLInputElement;
this.setState({
showUtc: target.checked,
});
};
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: Set<string>) => {
const hiddenLogLevels: Set<LogLevel> = new Set(Array.from(hiddenRawLevels).map(level => LogLevel[level]));
this.setState({ hiddenLogLevels });
};
onClickScan = (event: React.SyntheticEvent) => {
event.preventDefault();
this.props.onStartScanning();
};
onClickStopScan = (event: React.SyntheticEvent) => {
event.preventDefault();
this.props.onStopScanning();
};
render() {
const {
data,
highlighterExpressions,
loading = false,
onClickLabel,
position,
range,
scanning,
scanRange,
} = this.props;
const { dedup, deferLogs, hiddenLogLevels, renderAll, showLocalTime, showUtc } = this.state;
let { showLabels } = this.state;
const hasData = data && data.rows && data.rows.length > 0;
const showDuplicates = dedup !== LogsDedupStrategy.none;
// Filtering
const filteredData = filterLogLevels(data, hiddenLogLevels);
const dedupedData = dedupLogRows(filteredData, dedup);
const dedupCount = dedupedData.rows.reduce((sum, row) => sum + row.duplicates, 0);
const meta = [...data.meta];
if (dedup !== LogsDedupStrategy.none) {
meta.push({
label: 'Dedup count',
value: dedupCount,
kind: LogsMetaKind.Number,
});
}
// Staged rendering
const processedRows = dedupedData.rows;
const firstRows = processedRows.slice(0, PREVIEW_LIMIT);
const lastRows = processedRows.slice(PREVIEW_LIMIT);
// Check for labels
if (showLabels === null) {
if (hasData) {
showLabels = data.rows.some(row => _.size(row.uniqueLabels) > 0);
} else {
showLabels = true;
}
}
// Grid options
// const cssColumnSizes = [];
// if (showDuplicates) {
// cssColumnSizes.push('max-content');
// }
// // Log-level indicator line
// cssColumnSizes.push('3px');
// if (showUtc) {
// cssColumnSizes.push('minmax(220px, max-content)');
// }
// if (showLocalTime) {
// cssColumnSizes.push('minmax(140px, max-content)');
// }
// if (showLabels) {
// cssColumnSizes.push('fit-content(20%)');
// }
// cssColumnSizes.push('1fr');
// const logEntriesStyle = {
// gridTemplateColumns: cssColumnSizes.join(' '),
// };
const scanText = scanRange ? `Scanning ${rangeUtil.describeTimeRange(scanRange)}` : 'Scanning...';
return (
<div className="logs-panel">
<div className="logs-panel-graph">
<Graph
data={data.series}
height="100px"
range={range}
id={`explore-logs-graph-${position}`}
onChangeTime={this.props.onChangeTime}
onToggleSeries={this.onToggleLogLevel}
userOptions={graphOptions}
/>
</div>
<div className="logs-panel-options">
<div className="logs-panel-controls">
<Switch label="Timestamp" checked={showUtc} onChange={this.onChangeUtc} small />
<Switch label="Local time" checked={showLocalTime} onChange={this.onChangeLocalTime} small />
<Switch label="Labels" checked={showLabels} onChange={this.onChangeLabels} small />
<ToggleButtonGroup
label="Dedup"
onChange={this.onChangeDedup}
value={dedup}
render={({ selectedValue, onChange }) =>
Object.keys(LogsDedupStrategy).map((dedupType, i) => (
<ToggleButton
className="btn-small"
key={i}
value={dedupType}
onChange={onChange}
selected={selectedValue === dedupType}
>
{dedupType}
</ToggleButton>
))
}
/>
{hasData &&
meta && (
<div className="logs-panel-meta">
{meta.map(item => (
<div className="logs-panel-meta__item" key={item.label}>
<span className="logs-panel-meta__label">{item.label}:</span>
<span className="logs-panel-meta__value">{renderMetaItem(item.value, item.kind)}</span>
</div>
))}
</div>
)}
</div>
</div>
<div className="logs-rows">
{hasData &&
!deferLogs &&
// Only inject highlighterExpression in the first set for performance reasons
firstRows.map(row => (
<Row
key={row.key + row.duplicates}
allRows={processedRows}
highlighterExpressions={highlighterExpressions}
row={row}
showDuplicates={showDuplicates}
showLabels={showLabels}
showLocalTime={showLocalTime}
showUtc={showUtc}
onClickLabel={onClickLabel}
/>
))}
{hasData &&
!deferLogs &&
renderAll &&
lastRows.map(row => (
<Row
key={row.key + row.duplicates}
allRows={processedRows}
row={row}
showDuplicates={showDuplicates}
showLabels={showLabels}
showLocalTime={showLocalTime}
showUtc={showUtc}
onClickLabel={onClickLabel}
/>
))}
{hasData && deferLogs && <span>Rendering {dedupedData.rows.length} rows...</span>}
</div>
{!loading &&
!hasData &&
!scanning && (
<div className="logs-panel-nodata">
No logs found.
<a className="link" onClick={this.onClickScan}>
Scan for older logs
</a>
</div>
)}
{scanning && (
<div className="logs-panel-nodata">
<span>{scanText}</span>
<a className="link" onClick={this.onClickStopScan}>
Stop scan
</a>
</div>
)}
</div>
);
}
}
| public/app/features/explore/Logs.tsx | 1 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.9992004036903381,
0.15128999948501587,
0.00016520936333108693,
0.0002114304807037115,
0.35748550295829773
] |
{
"id": 3,
"code_window": [
" [key: string]: string;\n",
"}\n",
"\n",
"export enum LogsDedupStrategy {\n",
" none = 'none',\n",
" exact = 'exact',\n"
],
"labels": [
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
],
"after_edit": [
"export enum LogsDedupDescription {\n",
" none = 'No de-duplication',\n",
" exact = 'De-duplication of successive lines that are identical, ignoring ISO datetimes.',\n",
" numbers = 'De-duplication of successive lines that are identical when ignoring numbers, e.g., IP addresses, latencies.',\n",
" signature = 'De-duplication of successive lines that have identical punctuation and whitespace.',\n",
"}\n",
"\n"
],
"file_path": "public/app/core/logs_model.ts",
"type": "add",
"edit_start_line_idx": 90
} | import _ from 'lodash';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';
export function infoPopover() {
return {
restrict: 'E',
template: '<i class="fa fa-info-circle"></i>',
transclude: true,
link: (scope, elem, attrs, ctrl, transclude) => {
const offset = attrs.offset || '0 -10px';
const position = attrs.position || 'right middle';
let classes = 'drop-help drop-hide-out-of-bounds';
const openOn = 'hover';
elem.addClass('gf-form-help-icon');
if (attrs.wide) {
classes += ' drop-wide';
}
if (attrs.mode) {
elem.addClass('gf-form-help-icon--' + attrs.mode);
}
transclude((clone, newScope) => {
const content = document.createElement('div');
content.className = 'markdown-html';
_.each(clone, node => {
content.appendChild(node);
});
const dropOptions = {
target: elem[0],
content: content,
position: position,
classes: classes,
openOn: openOn,
hoverOpenDelay: 400,
tetherOptions: {
offset: offset,
constraints: [
{
to: 'window',
attachment: 'together',
pin: true,
},
],
},
};
// Create drop in next digest after directive content is rendered.
scope.$applyAsync(() => {
const drop = new Drop(dropOptions);
const unbind = scope.$on('$destroy', () => {
drop.destroy();
unbind();
});
});
});
},
};
}
coreModule.directive('infoPopover', infoPopover);
| public/app/core/components/info_popover.ts | 0 | https://github.com/grafana/grafana/commit/487de2b832126060bb1001295765cd6dee3fdb34 | [
0.0001708946074359119,
0.0001686717150732875,
0.00016653267084620893,
0.0001682744623394683,
0.0000014409581581276143
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.