How do I turn "Line numbers" on or off in an extension I am making?
I am changing something but either Visual studio does not notice, or I am changing the wrong record. There is a setting Tools->Options->Text Editor/All Languages/General/Line Numbers but I cannot find it in the SettingsStore so I am trying out CSharp instead.
The code that does the change:
var readOnly = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
var writeable = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
var value = readOnly.GetPropertyNamesAndValues(#"Text Editor\CSharp")["Line Numbers"];
// => value == 1
writeable.SetInt32(#"Text Editor\CSharp", "Line Numbers", 0);
value = readOnly.GetPropertyNamesAndValues(#"Text Editor\CSharp")["Line Numbers"]; // => 0
// => value == 0
Update
I exported all settings (menu:Tools->Import and exportsettings) and searched through the resulting file. There was nothing looking like "Line numbers" even though there are several similar entries in the menu:Tools->Options.
I am with Visual Studio 2022 17.0.1. When I export my settings there is a property ShowLineNumbers.
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="AllLanguages" RegisteredName="AllLanguages" PackageName="Text Management Package"/>
<ToolsOptionsSubCategory name="Basic" RegisteredName="Basic" PackageName="Text Management Package">
<PropertyValue name="TabSize">4</PropertyValue>
<PropertyValue name="ShowChanges">true</PropertyValue>
<PropertyValue name="ShowLineNumbers">true</PropertyValue>
Related
This script is part of a legacy code that runs to create a GUI interface for editing text files to be used in analysis codes. There is a windows command script that references a ".sed" file which controls the formatting, editing, and help menu for the GUI. I would like to identify the coding language/rules used in these ".sed" files so that I can make a new more complicated input text file with descriptions of inputs.
Ideally, I would like to be able to use this code to create/edit ".csv" files which can be edited in Excel. This would potentially mean needing to avoid the set variable sizes/padding in the #file block of code below.
Any googling attempts to find more about the coding result in unix sed instructions that are not helpful.
UPDATE: I did find an additional exe in the shell folder of the legacy code for "sedwin.exe". When googled this seems to refer to an old "SEDT text editor for MS-DOS".
An example section from a ".sed" file is below:
<code>
#rem( version description information here )
#version(){"2.0"}
%--------------------------------------------------------------------
#file(seal2,native){
title1(A80);
title2(A80);
title3(A80);
r(G10),del(A1),ll(G10),c(G10),lg(G10),dg(G10),ngroov(I10);
ncase(I10),necc(I10),necase(I10),#for(i,1,necase,0){entlos[i](G10)};
#for(i,1,ncase,0){
speed[i](G10),ro[i](G10),nu[i](G10),delp[i](G10);
}
}
#edit(seal2){
#prompted(22,5,"SEAL2 Input Data"){
#help(){
" Code Name Here
"",
"Code description here"
};
#icon("Titles",titles){#titles();}
#icon("Seal Parameters",seal){#seal();}
#icon("Speed, Fluid Parameters",cases){#cases();}
}
}
#titles(){
#prompted(1,7,"Three Title Lines"){
#help(){
"These title lines will appear on the output of",
"the program.",
"",
"They are useful for identifying the output but",
"do not directly affect the results."
};
#datum("",title1,75,"");
#datum("",title2,75,"");
#datum("",title3,75,"");
}
}
#seal(){
#prompted(12,8,"Seal Parameters"){
#help(){
"Descriptions of inputs in this window.",
};
#datum("Shaft Radius (in)",r,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Land Length (in)",ll,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Seal Radial Clearance (in)",c,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Groove Length (in)",lg,15,"0.");
#float_check("Must be >= 0.0","(%g)>=0.");
#datum("Groove Depth (in)",dg,15,"0.");
#float_check("Must be >= 0.0","(%g)>=0.");
#datum("Number of Grooves (0=plain seal)",ngroov,15,"0");
#int_check("Must be >= 0","(%d)>=0");
#datum("Number of Eccentricities",necc,15,"1");
#int_check("Must be between 1 and 10","(%d)>0&&(%d)<11");
#icon("Entrance Loss Cases",losses){#losses();}
}
}
#new_file(seal2){
file_type=seal2;
unit_type=native;
titles=New;
title1=;
title2=;
title3="(SEAL2 Data File)";
del=",";
seal=New;
ll=0.0;
r=0.0;
c=0.0;
lg=0.0;
dg=0.0;
ngroov=0;
losses=New;
necc=1;
necase=1;
entlos[1...necase]=0.1;
cases=New;
ncase=1;
speed[1...ncase]=0.0;
delp[1...ncase]=0.0;
nu[1...ncase]=0.0;
ro[1...ncase]=0.0;
}
</code>
When you create file in CLion, the following header is placed in the top of file:
//
// Created by <username> on 14.01.18.
//
Someone can remove this header by go to Settings → Editor → File and Code Templates → Includes → C File Header. There will be text:
#if ($HEADER_COMMENTS)
//
// Created by $USER_NAME on ${DATE}.
#if ($ORGANIZATION_NAME && $ORGANIZATION_NAME != "")
// Copyright (c) $YEAR ${ORGANIZATION_NAME}#if (!$ORGANIZATION_NAME.endsWith(".")).#end All rights reserved.
#end
//
#end
I can delete this text and header will be removed. But looks like if I set $HEADER_COMMENTS variable to false then header will be removed too. So my question is:
What is $HEADER_COMMENTS variable and how can I change it?
See https://www.jetbrains.com/help/clion/creating-and-editing-file-templates.html
Apparently the variable ${HEADER_COMMENTS} is always true and used for testing purposes, so you can't influence it.
I found this post at when searching to do the same thing. I didn't want to delete the whole thing as I'm using CLion for college and I might have a use for a template but I don't like the current one. I "fixed" it by making the test a not if for now. I said I'd put it here in case anyone else came searching for the same idea.
#if (!$HEADER_COMMENTS)
//
// Created by $USER_NAME on ${DATE}.
#if ($ORGANIZATION_NAME && $ORGANIZATION_NAME != "")
// Copyright (c) $YEAR ${ORGANIZATION_NAME}#if (!$ORGANIZATION_NAME.endsWith(".")).#end All rights reserved.
#end
//
#end
I have compilation error in MSVC express 2013, when including "filesystem.h" on any .cpp file.
"error c2228 left of '.ptr' must have class/struct/union ".
It points to error in filesystem.h file, which is part of "\microsoft visual studio 12.0\vc\include"
template<class _Path> inline
bool remove(const _Path& _Pval)
{ // remove _Pval
-->> return (_Unlink(_Pval._Ptr()) == 0);
}
Thank you for any suggestion.
After repairing the installation of visual studio, the problem disappeared.
In SSIS (MS Visual Studio 2010) I have created a SQL Task with Single Row output (int32) that is passed to User::Variable. Then I have a "For Loop" that I want to run as many times as the integer from the SQL Task query equals to. I have setup the For Loop with the following:
InitExpression: #Start = 1
EvalExpression: #Variable >= #Start
AssignExpression: #Start = #Start+1
In my test example, the #Variable is set to 4 by SQL Task query, and the loop runs fine for the first loop, but then immediately finishes reporting package successfully executed (after just 1 loop when it should have looped 4 times).
It is like the #Variable resets to default value (0) after the first loop is done instead of keeping the original value (4).
How can I fix this?
What's more likely: using the name Variable, which SSIS defaults to for a new variable, is incompatible with anything in an SSIS package or that you've done something that you haven't shown?
I have created a package with two Variables, Variable and Start. I have populated Variable from a SQL Query with the value of 4 and then used a For Loop as described and I did not experience early termination.
My package, variables with design time values set to zero.
My For Loop Container
Last iteration of the loop
Reproducible results
Biml, the Business Intelligence Markup Language, describes the platform for business intelligence. Here, we're going to use it to describe the ETL. BIDS Helper, is a free add on for Visual Studio/BIDS/SSDT that addresses a host of shortcomings with it.
You will need to edit line 3 to be a valid OLE DB Connection Manager for your machine (point to a SQL Server installation and possibly update the Provider)
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<OleDbConnection Name="CM_OLE" ConnectionString="Data Source=localhost\dev2012;Initial Catalog=tempdb;Provider=SQLNCLI11;Integrated Security=SSPI;" />
</Connections>
<Packages>
<Package Name="so_25878932" ConstraintMode="Linear">
<Variables>
<Variable Name="Variable" DataType="Int32">0</Variable>
<Variable Name="Start" DataType="Int32">0</Variable>
</Variables>
<Tasks>
<ExecuteSQL ConnectionName="CM_OLE" Name="SQL Variable" ResultSet="SingleRow">
<DirectInput>SELECT 4 AS Variable;</DirectInput>
<Results>
<Result Name="0" VariableName="User.Variable"/>
</Results>
</ExecuteSQL>
<ForLoop ConstraintMode="Linear" Name="FLC Go">
<InitializerExpression>#Start = 1</InitializerExpression>
<LoopTestExpression>#Variable >= #Start</LoopTestExpression>
<CountingExpression>#Start = #Start + 1</CountingExpression>
<Tasks>
<!--
Pilfered from http://bimlscript.com/Snippet/Details/74
-->
<Script
ProjectCoreName="ST_232fecafb70a4e8a904cc21f8870eed0"
Name="SCR Emit Variable and Start">
<ReadOnlyVariables>
<ReadOnlyVariable VariableName="User.Variable" />
<ReadOnlyVariable VariableName="User.Start" />
</ReadOnlyVariables>
<ScriptTaskProject>
<ScriptTaskProject ProjectCoreName="ST_c41ad4bf47544c49ad46f4440163feae" Name="TaskScriptProject1">
<AssemblyReferences>
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ManagedDTS.dll" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ScriptTask.dll" />
<AssemblyReference AssemblyPath="System.dll" />
<AssemblyReference AssemblyPath="System.AddIn.dll" />
<AssemblyReference AssemblyPath="System.Data.dll" />
<AssemblyReference AssemblyPath="System.Windows.Forms.dll" />
<AssemblyReference AssemblyPath="System.Xml.dll" />
</AssemblyReferences>
<Files>
<File Path="AssemblyInfo.cs">
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("ST_c41ad4bf47544c49ad46f4440163feae.csproj")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Varigence")]
[assembly: AssemblyProduct("ST_c41ad4bf47544c49ad46f4440163feae.csproj")]
[assembly: AssemblyCopyright("Copyright # Varigence 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
</File>
<File Path="ScriptMain.cs">
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
// if SSIS2012, use the following line:
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
// if earlier version, use the next line instead of the above line:
// [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
public void Main()
{
int i = 0;
MessageBox.Show(string.Format("{0}:{1}", Dts.Variables[i].Name, Dts.Variables[i].Value));
i++;
MessageBox.Show(string.Format("{0}:{1}", Dts.Variables[i].Name, Dts.Variables[i].Value));
Dts.TaskResult = (int)ScriptResults.Success;
}
}
</File>
</Files>
</ScriptTaskProject>
</ScriptTaskProject>
</Script>
<ExecuteProcess Executable="cmd.exe" Name="EP Do nothing" Arguments="/C">
</ExecuteProcess>
</Tasks>
</ForLoop>
</Tasks>
</Package>
</Packages>
</Biml>
Root cause guess
Variables can be created at different scopes within a package. I would presume that since a variable is created with the default name of Variable two, or more, such variables exist with the same name but at different application scopes. Thus, if I had defined a second SSIS variable named Variable on my ForLoop Container, it would start with a value of 0, unless defined otherwise. My package execution would begin, assign the value of 4 to my package level Variable. Control switches to my ForLoop Container. The Variable defined there wins from a scoping perspective so my value there is 0, not 4 because nothing has initialized it. In that case, the ForLoop would never fire as the terminal condition has already been met. For your case, I further presume that someone initialized that variable to 1.
Notice the Scope here, this is what I believe to be your root cause.
Solution:
DO NOT name SSIS variables #Variable. Doing so will unintentionally cause the variable value to pick up exit codes of other processes in the package as they run.
In my case the #Variable value would automatically change to 0 after a successfully run Execute Process Task with exit code 0; or change to -1073741510 when that process run failed.
I have 4 space indentation in my coffee files and when I am compiling those I am getting errors:
CoffeeLint: YourFile.coffee compilation failed: CoffeeLint: Line contains inconsistent indentation; context: Expected 2 got 4
I found that http://www.coffeelint.org/ actually provides option to configure indentation and in Web Essentials menu there is option to edit Global CofeeLint settings. So I changed that option to be:
"indentation": {
"name": "indentation",
"value": 4,
"level": "error"
}
(changed value from 2 to 4)
But it makes no difference I even tried to change level from error to ignore still no success. I even tried to restart VS and Windows, What I am doing wrong?
Update 1.
As requested in comments here is code I have:
if 1
0
And also screenshot of it with View White Space ON:
If you are using coffeelint and you want to change the indentation value to 2 spaces then you must edit the coffeelint/lib/coffeelint.js file and change the value of the "value" to 2 as follows:
module.exports = Indentation = (function() {
Indentation.prototype.rule = {
name: 'indentation',
value: 2,
level: 'error',
message: 'Line contains inconsistent indentation',
description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n fourSpaces = () ->\n eightSpaces = () ->\n 'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default."
};
The file you edited is probably a generated file that is of no consequence.